#P454. 练82.3 选数
练82.3 选数
Description
Given integers , , ..., , and an integer (). From these integers, choose any integers and add them together to get a series of sums. For example, when , , and the integers are , , , , all possible combinations and their sums are:
Now, you need to calculate how many of these sums are prime numbers.
In the example above, only one sum is prime: .
Input Format
The first line contains and (, ).
The second line contains numbers:
... (), separated by spaces.
Output Format
A single integer representing the number of combinations that sum to a prime number.
Sample
4 3
3 7 12 191
Related
In following homework: