#P1566. 加等式
加等式
Description
For an integer set, we define an "addition equation" as follows: some element of the set can be expressed as the sum of other elements in the set. For example, in the set , there is one addition equation: . Moreover, and are the same addition equation, and it is the only addition equation of this set. Given an integer set, write a program to find the number of its addition equations.
Input Format
The first line contains , indicating the number of test cases.
The next lines each describe one test case. Each line starts with an integer , the number of elements in the set, followed by distinct integers , which are the elements of the set.
Output Format
For each test case, output one integer, the number of addition equations in the set.
3
3 1 2 3
3 1 2 5
6 1 2 3 5 4 6
1
0
7
Hint
,,。
Translated by ChatGPT 5
京公网安备 11011102002149号