atcoder#JSC2019QUALF. Candy Retribution
Candy Retribution
Score: points
Problem Statement
Find the number of sequences of non-negative integers that satisfy the following conditions:
- When the elements are sorted in non-increasing order, the -th and -th elements are equal.
Since the answer can be enormous, print it modulo .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the number of sequences of non-negative integers, modulo .
4 2 3 7
105
The sequences of non-negative integers that satisfy the conditions are:
$\begin{aligned} &(1, 1, 1, 0), (1, 1, 1, 1), (2, 1, 1, 0), (2, 1, 1, 1), (2, 2, 2, 0), (2, 2, 2, 1), \\ &(3, 0, 0, 0), (3, 1, 1, 0), (3, 1, 1, 1), (3, 2, 2, 0), (4, 0, 0, 0), (4, 1, 1, 0), \\ &(4, 1, 1, 1), (5, 0, 0, 0), (5, 1, 1, 0), (6, 0, 0, 0), (7, 0, 0, 0)\end{aligned}$
and their permutations, for a total of sequences.
2 1 4 8
3
The three sequences that satisfy the conditions are , , and .
141592 6535 89793 238462
933832916