atcoder#ARC156E. [ARC156E] Non-Adjacent Matching
[ARC156E] Non-Adjacent Matching
Score : points
Problem Statement
Find the number, modulo , of good sequences of length whose elements are integers between and , inclusive, and whose sum is at most .
Here, a length- sequence is said to be good if and only if there is a graph that satisfies all of the following conditions.
- is a graph with vertices numbered to without self-loops. (It may have multi-edges.)
- For each , the degree of vertex is .
- For each , no edge connects vertex and vertex . Here, vertex means vertex .
Constraints
- All numbers in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
4 1 2
3
The following three sequences are good.
10 0 0
1
314 159 26535
248950743
Print the count modulo .