atcoder#ARC126A. [ARC126A] Make 10
[ARC126A] Make 10
Score : points
Problem Statement
We have sticks of length each, sticks of length each, and sticks of length each. You can do the following operation any number of times.
- Choose two sticks.
- Let and be the lengths of these sticks. Bond them to form a stick of length .
Find the maximum number of sticks that can be made whose lengths are exactly .
Given test cases, solve each of them.
Constraints
Input
Input is given from Standard Input in the following format:
Each case is in the following format:
Output
Print lines; the -th line should contain the answer for .
5
3 4 1
7 0 0
0 0 7
0 0 0
1000000000000000 1000000000000000 1000000000000000
2
1
0
0
900000000000000
Let us describe the first case. We have three sticks of length , four sticks of length , and one stick of length .
One way to make two sticks of length exactly is as follows.
- Bond four sticks of length , , , in some order to make one stick of length .
- Bond three sticks of length , , in some order to make one stick of length .
- Now we have three sticks of length , , .