
ZOJ Problem Set  2811
George has K ≤ 20 steel wires shaped in the form of halfcircles, with radii a_{1}, a_{2},..., a_{K} . They can be soldered (connected) at the ends, in any angle. Is it possible for George to make a closed shape out of these wires? He does not have to use all the wires. The wires can be combined at any angle, but may not intersect. Beware of floating point errors. Input Each data set consists of a number 0 < K ≤ 20 on a line by itself, followed by a line of K spaceseparated numbers ai . Each number is in the range 0 < a_{i} < 10^{7} , and has at most 3 digits after the decimal point. The input will be terminated by a zero on a line by itself. Output For each test case, there should be one word on a line by itself; "YES" if it is possible to make a simple connected figure out of the given arcs, and "NO" if it isn��t. Sample Input
1 Sample Output
NO Source: Nordic 2005 