#K67502. Subset Prime Sum

    ID: 32656 Type: Default 1000ms 256MiB

Subset Prime Sum

Subset Prime Sum

You are given an integer array of length ( N ). Your task is to determine if there exists a non-empty subset of the array such that the sum of its elements is a prime number. Recall that a prime number is a natural number greater than 1 with no positive divisors other than 1 and itself, i.e., it satisfies ( p > 1 ) and its only divisors are 1 and ( p ).

inputFormat

The input consists of multiple test cases. The first line contains an integer ( T ) denoting the number of test cases. For each test case, the first line contains an integer ( N ) representing the number of elements in the array. This is followed by a second line which contains ( N ) space-separated integers.

outputFormat

For each test case, print a single line containing the answer: ( YES ) if there exists at least one non-empty subset of the array whose sum is a prime number, or ( NO ) otherwise.## sample

3
4
1 2 3 4
3
10 15 20
5
2 3 5 7 11
YES

NO YES

</p>