|
||||||||||
Find differentTime Limit: 8000/4000 MS (Java/Others) Memory Limit: 524288/262144 K (Java/Others)Total Submission(s): 206 Accepted Submission(s): 98 Problem Description You are given two integers $n$,$m$. Two array $x=\{x_0,x_1,\dots ,x_{l-1}\},y=\{ y_0,y_1,\dots ,\ y_{l-1}\}$ of length $l$ are considered **different** if $x$ couldn't become $ y$ by performing the following operations any number of times: $\bullet\ $operation 1$:$ Change $x$ to $b$ , for each $i$ $(0\leq i< l), b_i\ =\ (x_i + 1 )\ mod\ m$ $\bullet\ $operation 2$:$ Change $x$ to $b$ , for each $i$ $(0\leq i< l),b_i\ =\ x_{ (i+1)\ mod\ l } $ As an example, if $m=3,\ l=3$, $(0,2,2)$ and $(0,1,0)$ are considered **not different** because $(0,2,2)$ can become $(0,1,0)$ as follows: $(0,2,2)\stackrel{operation \ 1}{\longrightarrow}(1,0,0)\stackrel{operation \ 2}{\longrightarrow}(0,0,1)\stackrel{operation \ 2}{\longrightarrow}(0,1,0)$ For each $i$ $($$1\leq i\leq n$$)$, find the number of different integer array $a$ of length $i$, satisfied $\forall j \in ( 0,1,\dots ,{i-1} ) , 0\le a_j \le m-1$. Since the answer may be too large, print it modulo $998244353$. Input The first line of the input contains one integer $T$ $($$1\leq T\leq 100$$)$--- the number of test cases. Then $T$ testcases follow. Each of the next $T$ lines contains two integers $n,m$ $($$1\leq n,m\leq 100000$$)$. The sum of $n$ over all testcases doesn't exceed $10^{6}$. Output For each testcase,output one line contains $n$ integers, separated by space, the $i$-th integer indicating the number of different $a$ of length $i$, modulo $998244353$. **Don‘t have spaces at the end of the line** Sample Input
Sample Output
Source | ||||||||||
|