Count the Sequences
Time limit1sMemory limit512 MB
Count sequences x_1 to x_m where each 0 <= x_i <= b^i - c and the sum is below n, modulo 998244353.
- Level
Hard8 of 10
- Topics
- Dynamic programming, Combinatorics, Math
- Solved
- No attempts yet
Problem
Four integers , , , and are given. Count the integer sequences that satisfy the following conditions:
Print the answer modulo 998 244 353.
Input
The first line contains three integers , , and (, , ). The second line contains a large integer ().
Output
Print one integer, the number of sequences modulo 998 244 353.