#P2946. [USACO09MAR] Cow Frisbee Team S
[USACO09MAR] Cow Frisbee Team S
Description
Lao Tang has recently gotten into frisbee, and John wants to play with him, so he plans to select a team from his cows.
Each cow has an integer ability. The -th cow’s ability is . The number of players on the frisbee team must be between and inclusive. A team’s total ability is the sum of the abilities of all its members.
John is superstitious, and his lucky number is , so he requires the team’s total ability to be a multiple of . Please compute how many team selections satisfy this requirement. Since this number can be very large, output the answer modulo .
Input Format
The first line contains two space-separated integers: and .
Lines through : line contains an integer , the ability of the -th cow.
Output Format
A single integer: the number of valid selections modulo .
4 5
1
2
8
2
3
Hint
For of the testdata, , , .
Translated by ChatGPT 5
京公网安备 11011102002149号