Melborp Lacissalc
Time limit2sMemory limit1024 MB
Count length-n arrays over 0 to k-1 for which exactly t consecutive subarrays have a sum divisible by k, modulo 998244353.
- Level
Medium6 of 10
- Topics
- Dynamic programming, Prefix sum, Combinatorics
- Solved
- No attempts yet
Statement
Grammy has a favorite number . She thinks that all the numbers divisible by are good.
For each array containing only numbers from to , Grammy defines its goodness as the number of non-empty consecutive subarrays that sum to a good number.
Please count the number of arrays of length such that their goodness is . Since the answer can be enormous, output the answer modulo .
Input
A single line contains three integers , , (, ).
Output
Output a single integer, the answer modulo .