atcoder#ARC145F. [ARC145F] Modulo Sum of Increasing Sequences
[ARC145F] Modulo Sum of Increasing Sequences
Score : points
Problem Statement
Find the number, modulo , of non-decreasing sequences of length consisting of integers between and (inclusive) that satisfy the following, for each :
- the sum of the elements in is congruent to modulo .
What is a non-decreasing sequence?
$$B$$$$B_i \leq B_{i+1}$$$$1 \le i \le |B| - 1$$$$|B|$$$$B $$Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
For each , print the number, modulo , of sequences that satisfy the condition.
2 2 4
2 1 2 1
There are non-decreasing sequences of length consisting of integers between and : . Here, we have:
- sequences whose sums are congruent to modulo : ;
- sequence whose sum is congruent to modulo : ;
- sequences whose sums are congruent to modulo : ;
- sequence whose sum is congruent to modulo : .
3 45 3
5776 5760 5760
1000000 1000000 6
340418986 783857865 191848859 783857865 340418986 635287738
Print the counts modulo .