#t110. 平衡序列
平衡序列
Balanced Sequence
Problem Background
A corresponding multiple-choice / true-or-false problem: https://ti.luogu.com.cn/problemset/1159
Problem Description
Xiaoyang has a sequence of positive integers. He considers a sequence balanced if and only if there exists a positive integer () such that the sum of the first numbers equals the sum of the numbers from position to .
Xiaoyang wants you to tell whether the sequence is balanced.
Input Format
This problem contains multiple test cases within a single test point. The first line is a positive integer , the number of test cases.
This is followed by test cases. Each test case spans two lines:
- The first line contains a positive integer , the length of the sequence.
- The second line contains positive integers, the elements of sequence .
Output Format
For each test case output one line containing a string. If is balanced, output Yes; otherwise output No.
Sample Input
3
3
1 2 3
4
2 3 1 4
5
1 2 3 4 5
Sample Output
Yes
Yes
No
Sample Explanation
- For the first test case, taking gives , so the sequence is balanced.
- For the second test case, taking gives , so the sequence is balanced.
- For the third test case, no such exists.
Constraints
For all test data, , .