#P7631. [COCI 2010/2011 #5] GLJIVE
[COCI 2010/2011 #5] GLJIVE
Description
There are mushrooms in front of Super Mario, arranged in a row. Picking each mushroom gives some score.
Super Mario must pick mushrooms in the order they appear, but he does not have to pick them all. His goal is to get a total score as close to as possible. The picked mushrooms must start from the first one and be consecutive.
If there are two totals equally close to (for example, and ), Mario will choose the larger one (here, ).
Help Super Mario and tell him how many points he can get.
Input Format
The input consists of lines. Each line contains a positive integer , representing the score obtained by picking the current mushroom, in the order Mario picks them.
Output Format
Output line with one integer, representing the score Mario can get.
10
20
30
40
50
60
70
80
90
100
100
1
2
3
5
8
13
21
34
55
89
87
40
40
40
40
40
40
40
40
40
40
120
Hint
[Sample Explanation #1]
Mario picks up to the -th mushroom and gets points.
[Constraints]
For of the testdata, .
[Notes]
The scoring for this problem follows the original COCI problem settings, with a full score of .
Translated from COCI2010-2011 CONTEST #5 T1 GLJIVE.
Translated by ChatGPT 5
京公网安备 11011102002149号