1059: Sub Set Sum
[Creator : ]
Description
There is a Set S of positive integers and a target integer T, and the question is to decide whether any subset of the
integers sum to precisely T
integers sum to precisely T
Input
The first line is one integer N which is the number of positive integers in S
The second line contains N positive integers
The third line is one integer which is T
$ 1 \leq N \leq 25 $
$ 1 \leq T \leq 1000 $
The second line contains N positive integers
The third line is one integer which is T
$ 1 \leq N \leq 25 $
$ 1 \leq T \leq 1000 $
Output
One string "YES" or "NO"
Sample Input Copy
6
6 2 4 21 5 8
15
Sample Output Copy
YES
HINT
In the example, we can have a subset of {2, 5, 8} with 2+5+8=15, then the answer is YES