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
hide comments
harsh_verma:
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)
|
|
davidgalehouse:
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 |
|
baadshah_:
2016-07-16 08:00:26
My 100th !!
|
|
adichd123:
2016-07-14 09:05:50
Thankyou @Paranoid Android for this comment-
|
|
alok singh:
2016-07-13 22:12:09
amazing quetion |
|
aks1881996:
2016-07-13 15:51:47
Easy one if you don't understand read comment by Paranoid Android(last page) |
|
Sarthak Munshi:
2016-07-06 21:02:18
v. poorly framed problem ! very easy though . just work out different cases . |
|
Wumbolo:
2016-06-29 13:57:58
very easy, very short, just be careful. |
|
Deepak :
2016-06-23 13:07:35
total waste..misguiding problem statement..AC after 4 submissions.read comments. |
|
tushar_verma1:
2016-06-20 09:09:17
Easy :) just read carefully!! AC in one go Last edit: 2016-06-20 09:10:08 |
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 |