-->
当前位置:首页 > 题库

PROGRAMMING:Xiao Ming plays games

Luz5年前 (2021-05-10)题库493
Xiaoming is playing the game of upgrading to fight monsters. This game allows players to choose from the i-th level to the j-th level (I < = J). Gold coins will be awarded or deducted for each level. Given the number of gold coins awarded or deducted in each level, which level should Xiao Ming choose to play continuously to get the most gold coins? Please note that Xiao Ming can only choose once. Of course, if he has no harvest, he can not choose.
###Input format:
There are two lines of input:
The first line is the total number of customs clearance n;
The second line is the number of gold coins to be awarded or deducted for each level (the whole number represents the reward and the negative number represents the deduction)
###Output format:
Output the maximum number of gold coins Xiao Ming can get.
###Input sample 1:
```in
six
-1 23 -9 14 -2 -1
```
###Output sample 1:
```out
twenty-eight
```
Note: Xiaoming chooses to play from the second level to the fourth level, and the total number of gold coins is 28, which is the best choice strategy in line with the rules.
###Input sample 2:
```in
three
-1 -2 -3
```
###Output sample 2:
```out
0
```
Note: each level is negative, do not play< br>





answer:If there is no answer, please comment