#P1441. 砝码称重
砝码称重
Description
There are weights with masses . After removing exactly weights, ask for the maximum number of different measurable weights (excluding ).
Note that weights can only be placed on one side of the balance.
Input Format
The first line contains two integers and , separated by a space.
The second line contains positive integers , representing each weight’s mass.
Output Format
Output a single integer: the maximum number of different measurable weights.
3 1
1 2 2
3
Hint
[Sample Explanation]
After removing one weight of , you can measure , for a total of distinct weights.
[Constraints]
- For of the testdata, .
- For of the testdata, .
- For of the testdata, .
- For of the testdata, , , , .
Translated by ChatGPT 5
京公网安备 11011102002149号