#P1036. [NOIP 2002 普及组] 选数
[NOIP 2002 普及组] 选数
Description
Given integers , and one integer (). Choose any integers from the integers and add them up to obtain a set of sums. For example, when , , and the four integers are , all combinations and their sums are:
.
.
.
.
Now, you are required to compute how many of these sums are prime numbers.
For example, in the case above, only one sum is prime: .
Input Format
The first line contains two integers separated by a space (, ).
The second line contains integers ().
Output Format
Output a single integer representing the number of ways.
4 3
3 7 12 19
1
Hint
【Source】
NOIP 2002 Junior, Problem 2.
Translated by ChatGPT 5
京公网安备 11011102002149号