1686. simple counting problem

时间限制 1000 ms   内存限制 512 MB

Given $m, b, c, n$, please calculate the number of sequence $x_1, x_2, x_3, \dots, x_m$ which satisfies :
$0 \leq x_i\leq b ^ i - c, x_i \in \mathbb{Z}$
$\sum_{i = 1}^{m}{x_i} < n$.
Output the answer module 998244353.
$1\leq m\leq 50$
$2\leq b \leq 10^9, -b + 2 \leq c \leq b - 1$
$1\leq n< b^{m + 1}$

输入数据

There are several test cases, please keep reading until EOF.
For each test case, the first line consists of 3 integers $m, b, c$.
The next line consists of a big integer $n$.
There are 10 test cases.

输出数据

For each test case, output Case #x: y, which means the the test case number and the answer.

样例输入

复制
2 2 1
3 · · \n
 \n

样例输出

复制
Case #1: 5    ·   · \n

提交

请先 登录

Source

2017 Multi-University Training Contest - Team 3

© 2025 FAQs Contact About