Submit | All submissions | Best solutions | Back to list |
GLJIVE - GLJIVE |
In front of Super Mario there are 10 mushrooms, arranged in a row. A certain amount of points is awarded for picking each of the mushrooms. Super Mario must pick mushrooms in order they appear, but is not required to pick them all – his goal is to score a number of points as close as possible to 100.
In case there exist two such numbers which are equally close to 100 (e.g. 98 and 102), Mario will pick the greater one (in this case 102).
Help Super Mario and tell him how many points he will score.
Input
Input consists of 10 lines, each of which contains one positive integer less than or equal to 100, denoting the scores awarded for picking each mushroom, in the order that Mario can pick them in.
Output
The first and only line of output must contain the required number of points.
Example
Input: 10 20 30 40 50 60 70 80 90 100 Output: 100
Added by: | akaki |
Date: | 2011-02-13 |
Time limit: | 0.205s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | coci |
hide comments
|
||||||||||||||
2016-10-31 15:45:11
you have to always start form the first index and move selecting mushrooms till u reach 100(without skipping any in between) 1 2 3 5 8 13 21 34 55 89 will give 87 not 100 not 110 by 1+2+3+5+8+13+21+34 |
||||||||||||||
2016-10-15 20:38:51
To summarize more clearly: we're looking for a **contiguous** subsequence starting from the **first** index, but not necessarily spanning all 10. The example considers the elements {10, 20, 30, 40} to get the result of 100. Last edit: 2016-10-15 20:44:05 |
||||||||||||||
2016-07-16 08:00:26
My 100th !! Read the comments to understand the problem!! AC in one Go! |
||||||||||||||
2016-07-14 09:05:50
Thankyou @Paranoid Android for this comment- For those who can't decipher what the problem asks please read my rephrased statement below : Select mushrooms in order starting from 1. You can't select mushrooms like 1,3,7 but it should be 1,2,3,4...10. You can stop in between if you get a value "closest" to 100. If there is a tie between two numbers equally "close" to 100 select the larger one. |
||||||||||||||
2016-07-13 22:12:09 alok singh
amazing quetion |
||||||||||||||
2016-07-13 15:51:47
Easy one if you don't understand read comment by Paranoid Android(last page) |
||||||||||||||
2016-07-06 21:02:18 Sarthak Munshi
v. poorly framed problem ! very easy though . just work out different cases . |
||||||||||||||
2016-06-29 13:57:58 Wumbolo
very easy, very short, just be careful. |
||||||||||||||
2016-06-23 13:07:35 Deepak
total waste..misguiding problem statement..AC after 4 submissions.read comments. |
||||||||||||||
2016-06-20 09:09:17
Easy :) just read carefully!! AC in one go Last edit: 2016-06-20 09:10:08 |