Sticks
Medium
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
Bob has a collection of sticks, each with a different length. He wants to see if he can form a polygon by connecting the ends of some or all of these sticks.
Write a program to determine if Bob can create a polygon using his sticks.
Input
The input consists of multiple test cases. Each test case begins with an integer N (where 3 ≤ N ≤ 20), representing the number of sticks. The following line lists N positive real numbers (each less than 10^7 and specified to three decimal places), which are the lengths of the sticks. A line containing "0" marks the end of the input and should not be processed.
Output
For each test case, output "YES" on a separate line if Bob can form a polygon with the given sticks; otherwise, output "NO".
Examples
Input #1
Answer #1
Submissions 402
Acceptance rate 16%