1060: Sub Set Sum Version 2
[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 , but with one constrain which all the integers who are multiple of 5 have to be used in the subset.
integers sum to precisely T , but with one constrain which all the integers who are multiple of 5 have to be used in the subset.
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
7
6 2 4 21 5 8 10
16
Sample Output Copy
NO