#P8742. [蓝桥杯 2021 省 AB] 砝码称重
[蓝桥杯 2021 省 AB] 砝码称重
Problem Description
You have a balance scale and weights. The weights have masses in order. Please compute how many different weights can be measured in total.
Note that the weights can be placed on both sides of the balance.
Input Format
The first line contains an integer .
The second line contains integers: .
Output Format
Output one integer representing the answer.
3
1 4 6
10
Hint
[Sample Explanation]
The 10 measurable weights are: .
$$\begin{aligned} &1=1 \\ &2=6-4(\text { place } 6 \text { on one side of the balance, and } 4 \text { on the other side) } \\ &3=4-1 \\ &4=4 \\ &5=6-1 \\ &6=6 \\ &7=1+6 \\ &9=4+6-1 \\ &10=4+6 \\ &11=1+4+6 \end{aligned}$$[Scale and Constraints for Test Cases]
For of the test cases, .
For all test cases, , and the total weight of the weights does not exceed .
Lanqiao Cup 2021 First Round Provincial Contest, Group A Problem F (Group B Problem G).
Translated by ChatGPT 5