Pro.ID22844 TitlePhone Number Title链接http://10.20.2.8/oj/exercise/problem?problem_id=22844 AC21 Submit34 Ratio61.76% 时间&空间限制描述We know that if a phone number A is another phone number B's prefix, B is not able to be called. For an example, A is 123 while B is 12345, after pressing 123, we call A, and not able to call B. Given N phone numbers, your task is to find whether there exits two numbers A and B that A is B's prefix. 输入The input consists of several test cases. The first line of input in each test case contains one integer N ( 0 < N < 1001 ), represent the number of phone numbers. The next line contains N integers, describing the phone numbers. The last case isfollowed by a line containing one zero. 输出Description We know that if a phone number A is another phone number B's prefix, B is not able to be called. For an example, A is 123 while B is 12345, after pressing 123, we call A, and not able to call B. Given N phone numbers, your task is to find whether there exits two numbers A and B that A is B's prefix. Input The input consists of several test cases. The first line of input in each test case contains one integer N ( 0 < N < 1001 ), represent the number of phone numbers. The next line contains N integers, describing the phone numbers. The last case isfollowed by a line containing one zero. Output For each test case, if there exits a phone number that cannot be called, print "NO", otherwise print "YES" instead. Sample Input 2 Sample Output NO Source 样例输入2 样例输出NO 作者 |