モノグサプログラミングコンテスト2024(AtCoder Beginner Contest 345)
G
Sugoroku 5
AtCoder
⌀ 3343
原题
翻译中…

Problem Statement

翻译中…

There is a board game with $N+1$ squares: square $0$, square $1$, $\dots$, square $N$. You have a die (dice) that rolls an integer between $1$ and $K$, inclusive, with equal probability for each outcome. You start on square $0$. You repeat the following operation until you reach square $N$:

翻译中…
  • Roll the dice. Let $x$ be the current square and $y$ be the rolled number, then move to square $\min(N, x + y)$.
翻译中…

Let $P_i$ be the probability of reaching square $N$ after exactly $i$ operations. Calculate $P_1, P_2, \dots, P_N$ modulo $998244353$.

翻译中…

What is probability modulo $998244353$? It can be proved that the sought probabilities will always be rational numbers. Under the constraints of this problem, it can also be proved that when expressing the values as $\frac{P}{Q}$ using two coprime integers $P$ and $Q$, there is exactly one integer $R$ satisfying $R \times Q \equiv P\pmod{998244353}$ and $0 \leq R < 998244353$. Find this $R$.

翻译中…

Constraints

翻译中…
  • $1 \leq K \leq N \leq 2 \times 10^5$
  • $N$ and $K$ are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N K

翻译中…

Output

翻译中…

Print $N$ lines. The $i$-th line should contain $P_i$ modulo $998244353$.

翻译中…

样例

Input #1
3 2
Output #1
0
249561089
748683265
For example, you reach square $N$ after exactly two operations when the die rolls the following numbers: - A $1$ on the first operation, and a $2$ on the second operation. - A $2$ on the first operation, and a $1$ on the second operation. - A $2$ on the first operation, and a $2$ on the second operation. Therefore, $P_2 = \left( \frac{1}{2} \times \frac{1}{2} \right) \times 3 = \frac{3}{4}$. We have $249561089 \times 4 \equiv 3 \pmod{998244353}$, so print $249561089$ for $P_2$.
Input #2
5 5
Output #2
598946612
479157290
463185380
682000542
771443236
Input #3
10 6
Output #3
0
166374059
207967574
610038216
177927813
630578223
902091444
412046453
481340945
404612686
题目信息
题号
abc345_g
时间限制
12 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。