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
epsilonalpha: 2017-03-08 22:29:21

Unlclear problem statement.
The problem asks you to generate a cumulative sum starting from first value, closest to 100 in the 10 inputs given. In case the sum obtained is equal on both sides, print the bigger value. Stop inputs when sum > 100 and terminate the program with return statement after printing the result.

Example T/C's
40 40 40 40 40 40 40 40 40 40 => 120
10 10 10 10 10 10 10 10 10 9 => 99
10 10 10 10 10 10 10 10 20 1 => 100
10 10 10 10 10 10 10 10 19 2 => 101
1 2 3 5 8 13 21 34 55 89 => 87

I hope this helps everyone. :)

vineetpratik: 2017-03-06 12:59:59

My first downvote , statement of problem is unclear

nilabja16180: 2017-03-04 14:10:55

AC in one Go!
Comments helped!

scorpion_ajay: 2017-02-26 17:59:41

deserves my downvote....!

shubham2305: 2017-02-06 21:07:15

1 always start adding from first.
2 didn't need to take all 10 inputs take as much input as required.
3 take the nearest sum from 100 ie if candidate are 98 and 101 go for 101.
4 if nearest sum is same on both side take max one ie if candidate are 98 and 102 for 102.

i think this will help to understand the question clearly.

Last edit: 2017-02-06 21:08:09
coolio_1: 2017-01-27 20:01:00

Problem needs a bit more clarity. Comments helped a lot.

imperfectboy: 2017-01-17 08:51:28

AC in one GO !!! Read comments for help !!!

vunnamtej: 2017-01-14 17:29:42

He could have explained clearly

praney_rai: 2016-12-20 20:11:40

after 4 WA got AC!! really very f**king annoyed at this moment!! this ques.
deserves my downvote...

shubham_cs_iet: 2016-12-11 21:02:19

@triple M, thanks for your test case, i was missing that one.


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