Type: Default 1000ms 256MiB

练82.3 选数

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Description

Given nn integers x1x_1, x2x_2, ..., xnx_n, and an integer kk (k<nk < n). From these nn integers, choose any kk integers and add them together to get a series of sums. For example, when n=4n=4, k=3k=3, and the 44 integers are 33, 77, 1212, 1919, all possible combinations and their sums are:
3+7+12=223+7+12=22
3+7+19=293+7+19=29
7+12+19=387+12+19=38
3+12+19=343+12+19=34
Now, you need to calculate how many of these sums are prime numbers.
In the example above, only one sum is prime: 3+7+19=293+7+19=29.

Input Format

The first line contains nn and kk (1n201 ≤ n ≤ 20, k<nk < n).
The second line contains nn numbers:
x1x_1 x2x_2 ... xnx_n (1xi50000001 ≤ x_i ≤ 5000000), 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 19
1

20251025D班作业(4)

Not Claimed
Status
Done
Problem
12
Open Since
2025-10-26 0:00
Deadline
2025-11-3 23:59
Extension
24 hour(s)