#d2863. 吃糖果
吃糖果
Eating Candies
Problem Description
There are candies on a table, arranged from left to right and numbered in that order; the -th candy has weight . Xiao Ming and Xiao Hong want to eat the candies.
Xiao Ming starts from the left and eats any number of candies (contiguous, without skipping any candy).
Xiao Hong starts from the right and eats any number of candies (contiguous, without skipping any candy).
Of course, if Xiao Ming eats a certain candy, Xiao Hong cannot eat it (and vice versa).
Their goal is to eat the same total weight of candies. What is the maximum total number of candies they can eat together under this condition?
Input Format
The first line contains an integer , the number of candies on the table.
The second line contains integers , the weights of the candies from left to right.
Output Format
Output one integer: the maximum total number of candies Xiao Ming and Xiao Hong can eat together while satisfying the condition.
Sample Input
9
7 3 20 5 15 1 11 8 10
Sample Output
7
Constraints
,