
ZOJ Problem Set  3368
Jerry decided to congratulate his friend Jessica with Chinese New Year upcoming. He bought her a present  a nice collection of n colored candles. Now he wants to pack them to present to Jessica. He has made a nice triangular box and started to put candles inside, when it turned out that the box is too small. So now he wants to know how many candles he can put into the box. Help him. The box is a triangle with integer side lengths in inches. Each candle is a cylinder with radius of one inch. All candles must be put into the box vertically, so we can consider each candle as a circle when looking from above. Candle may touch each other and the box sides, but of course they must not be deformed. InputThe first line of the input file contains n (1 ≤ n ≤ 10). The next line contains three integer numbers  the lengths of the sides of the box. The lengths are positive and do not exceded 10. There are multiple cases. Process to the end of file. OutputOutput the maximal number of candles Jerry can pack into his box. Sample Input3 6 5 5 1 10 10 10 7 1 1 1 Sample Output2 1 0 Author: Andrew Stankevich Source: Andrew Stankevich's Contest #11 