#P7223. [RC-04] 01 背包
[RC-04] 01 背包
Description
There is a knapsack with capacity , and you want to put items into it.
You have items, and the -th item has volume .
You have a lucky number . If the sum of the volumes of the items you put in is , you will get a profit of . In particular, .
Compute the sum of profits over all ways of choosing items to put into the knapsack. The answer is very large, so output it modulo .
Input Format
The first line contains two integers .
The next line contains positive integers , describing the volumes of these items.
Output Format
Output one integer, the sum of profits over all ways modulo .
2 2
1 4
51
Hint
[Sample Explanation]
The answer is .
[Constraints]
For all testdata, , .
The detailed constraints are shown in the table below:
| Test Point ID | Score per Test Point | |||
|---|---|---|---|---|
Translated by ChatGPT 5
京公网安备 11011102002149号