#T522. 【NOIP2002-J2】选数
【NOIP2002-J2】选数
Description
Given n integers x1, x2, ..., xn, and an integer k (k < n). By selecting any k integers from the n integers and summing them up, a series of sums can be obtained. For example, when n=4, k=3, and the 4 integers are 3, 7, 12, and 19, all possible combinations and their sums are:
3 + 7 + 12 = 22 3 + 7 + 19 = 29 7 + 12 + 19 = 38 3 + 12 + 19 = 34.
Now, you are required to calculate how many of these sums are prime numbers.
In the example above, there is only one sum that is a prime number: 3 + 7 + 19 = 29.
Input Format
Input is read from the keyboard in the following format:
n , k (1 ≤ n ≤ 20,k < n)
x1, x2, ..., xn (1 ≤ xi ≤ 5000000)
Output Format
Output is displayed on the screen in the following format:
An integer (the number of valid combinations).
```input1 4 3 3 7 12 19 ``` ```output1 1 ``` ## TranslationNOIP2002-J2
(Note: Since "NOIP2002-J2" appears to be a competition identifier/code without additional context, I've kept it untranslated as it's likely an acronym for National Olympiad in Informatics in Provinces 2002 - Junior Level 2 or similar. Would you like me to provide the full expansion if this is incorrect?)