NPM998244353 (Hard)
Time limit5sMemory limit512 MB
For every digit-sum cap from 0 to MM, count length-N digit strings divisible by P, modulo 998244353.
- Level
Hard9 of 10
- Topics
- Combinatorics, Dynamic programming, Number theory, Matrix
- Solved
- No attempts yet
Problem
Count the integers of length that are divisible by and whose digit sum is at most . The leading digit may be 0, so every sequence of digits taken from 0 to 9 counts as one integer of length . For , both 00 and 03 are counted.
For each , compute the number of such integers modulo 998244353.
Input
The first line contains , , and , separated by spaces. (, , )
Output
Print integers on the first line, separated by single spaces. The -th integer () is the answer for : the number of integers of length that are divisible by and whose digit sum is at most , modulo 998244353.
Hint
For and the counted numbers are:
- : 00
- : 00, 03, 12, 21, 30
For and :
- : 00
- : 00, 20
- : 00, 12, 20
- : 00, 04, 12, 20, 40