luogu#P1680. 奇怪的分组
奇怪的分组
Background
After finally solving classmate dm’s difficult problem, dm agreed to help contact “V-shen”. However, dm has a habit: when contacting classmates, he prefers to contact them in groups, and the grouping method is special — the number of people in the -th group must be greater than a specified number . While dm was contacting people, “V-shen” wondered how many grouping plans there could be under dm’s rules. He thought and thought, but still couldn’t figure it out. So he turned to you for help: can you compute how many grouping plans there are according to dm’s rules?
Problem Description
There are people in V-shen’s class. dm wants to split them into groups. The number of people in the -th group must be greater than the given positive integer . How many different plans are there? Two plans are considered the same if and only if, for every , the sizes of the -th group are equal in both plans. Since the answer can be large, output it modulo .
Input Format
The first line contains two integers and . The next lines each contain one integer, denoting .
Output Format
Output a single line containing one integer — the number of plans modulo .
10 3
1
2
3
3
Hint
Sample Explanation: There are three plans, with group sizes , , and .
Constraints:
- For of the testdata, .
- For of the testdata, .
- For of the testdata, , .
The testdata guarantees that there is at least one valid plan.
Translated by ChatGPT 5