309373: CF1669F. Eating Candies
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:2
Solved:0
Description
Eating Candies
题意翻译
## 题意 有 $n$ 个糖果从左往右放在桌子上, $Alice$ 和 $ Bob $ 吃糖果, $Alice$可以从左边开始吃, $Bob$可以从右边开始吃,他们需要连续吃,不能跳过任何一颗糖果,如果 $Alice$ 吃掉了糖果, $Bob$ 就不能吃,反之亦然,他们的目标是吃到等重的糖果。 ## 输入 第一行是一个整数 $t$ 表示测试样例的数量,接下来的每一组样例的第一行是一个整数 $n$ 表示糖果数量,第二行是 $n$ 个整数$w_1,w_2.,..,w_n$ ,表示从左往右的糖果重量。 ## 输出 对于每组测试样例,输出一个整数,表示他们同时能吃到的最多糖果数题目描述
There are $ n $ candies put from left to right on a table. The candies are numbered from left to right. The $ i $ -th candy has weight $ w_i $ . Alice and Bob eat candies. Alice can eat any number of candies from the left (she can't skip candies, she eats them in a row). Bob can eat any number of candies from the right (he can't skip candies, he eats them in a row). Of course, if Alice ate a candy, Bob can't eat it (and vice versa). They want to be fair. Their goal is to eat the same total weight of candies. What is the most number of candies they can eat in total?输入输出格式
输入格式
The first line contains an integer $ t $ ( $ 1 \leq t \leq 10^4 $ ) — the number of test cases. The first line of each test case contains an integer $ n $ ( $ 1 \leq n \leq 2\cdot10^5 $ ) — the number of candies on the table. The second line of each test case contains $ n $ integers $ w_1, w_2, \dots, w_n $ ( $ 1 \leq w_i \leq 10^4 $ ) — the weights of candies from left to right. It is guaranteed that the sum of $ n $ over all test cases does not exceed $ 2\cdot10^5 $ .
输出格式
For each test case, print a single integer — the maximum number of candies Alice and Bob can eat in total while satisfying the condition.
输入输出样例
输入样例 #1
4
3
10 20 10
6
2 1 4 2 4 1
5
1 2 4 8 16
9
7 3 20 5 15 1 11 8 10
输出样例 #1
2
6
0
7