#T417. 【NOIP1996-S4】砝码称重
【NOIP1996-S4】砝码称重
Description
There are several weights of 1g, 2g, 3g, 5g, 10g, and 20g (the total weight ≤ 1000).
Given the quantities of each type of weight, calculate the number of distinct weights that can be measured using these weights, excluding the case where no weights are used.
For example, if the input is: 1 1 0 0 0 0
The output would be: Total=3, indicating that the measurable weights are 1g, 2g, and 3g.
Input Format
Each test file contains only one test case, with six integers as input, for example:
Input a1 a2 a3 a4 a5 a6
(where a1 represents the number of 1g weights, a2 the number of 2g weights, ..., and a6 the number of 20g weights)
Output Format
For each input, output Total=N.(N represents the number of distinct measurable weights, excluding the case where no weights are used)
NOIP1996-S4