#P2347. [NOIP 1996 提高组] 砝码称重

[NOIP 1996 提高组] 砝码称重

Description

Given several weights of 1g1\mathrm{g}, 2g2\mathrm{g}, 3g3\mathrm{g}, 5g5\mathrm{g}, 10g10\mathrm{g}, and 20g20\mathrm{g} (whose total weight is 1000\le 1000), how many distinct total weights can be measured?

Input Format

Input: a1,a2,a3,a4,a5,a6a_1, a_2, a_3, a_4, a_5, a_6.

(This means there are a1a_1 weights of 1g1\mathrm{g}, a2a_2 weights of 2g2\mathrm{g}, \dots, and a6a_6 weights of 20g20\mathrm{g}.)

Output Format

Output: Total=N.

(NN is the number of distinct total weights that can be measured using these weights, excluding the case where no weight is used.)

1 1 0 0 0 0
Total=3

Hint

Source: NOIP 1996 Senior Problem 4.

Translated by ChatGPT 5