AtCoder Beginner Contest 217
翻译中…
Problem Statement
翻译中…
You are given positive integers $N$ and $M$. For each $k=1,\ldots,N$, solve the following problem.
翻译中…
- Problem: We will divide
$N$people with ID numbers$1$through$N$into$k$non-empty groups. Here, people whose ID numbers are equal modulo$M$cannot belong to the same group. How many such ways are there to divide people into groups? Since the answer may be enormous, find it modulo$998244353$.
翻译中…
Here, two ways to divide people into groups are considered different when there is a pair $(x, y)$ such that Person $x$ and Person $y$ belong to the same group in one way but not in the other.
翻译中…
Constraints
翻译中…
$2 \leq N \leq 5000$$2 \leq M \leq N$- All values in input are integers.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N M
翻译中…
Output
翻译中…
Print $N$ lines.
翻译中…
The $i$-th line should contain the answer for the problem with $k=i$.
翻译中…
样例
Input #1
4 2
Output #1
0
2
4
1
People whose ID numbers are equal modulo $2$ cannot belong to the same group. That is, Person $1$ and Person $3$ cannot belong to the same group, and neither can Person $2$ and Person $4$.
- There is no way to divide the four into one group.
- There are two ways to divide the four into two groups: $\{\{1,2\},\{3,4\}\}$ and $\{\{1,4\},\{2,3\}\}$.
- There are four ways to divide the four into three groups: $\{\{1,2\},\{3\},\{4\}\}$, $\{\{1,4\},\{2\},\{3\}\}$, $\{\{1\},\{2,3\},\{4\}\}$, and $\{\{1\},\{2\},\{3,4\}\}$.
- There is one way to divide the four into four groups: $\{\{1\},\{2\},\{3\},\{4\}\}$.
Input #2
6 6
Output #2
1
31
90
65
15
1
You can divide them as you like.
Input #3
20 5
Output #3
0
0
0
331776
207028224
204931064
814022582
544352515
755619435
401403040
323173195
538468102
309259764
722947327
162115584
10228144
423360
10960
160
1
Be sure to find the answer modulo $998244353$.
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。