P28263 [洛谷] 【Template】Fast Power of Polynomials
提高+
题目描述

Problem Description

Given a polynomial $A(x)$ of degree $n-1$, find a polynomial $B(x)$ in the $\bmod\ x^n$ sense such that $B(x) \equiv (A(x))^k \ (\bmod\ x^n)$.

The coefficients of the polynomial are computed in the $\bmod\ 998244353$ sense.

Input Format

The first line contains two integers $n$ and $k$.

The next $n$ integers represent the coefficients $a_0, a_1, ..., a_{n-1}$ of $A(x)$.

Output Format

Output $n$ integers representing the first $n$ coefficients $b_0, b_1, ..., b_{n-1}$ of $B(x)$ in the $\bmod\ 998244353$ sense.

Sample Input and Output

Sample Input #1

9 18948465
1 2 3 4 5 6 7 8 9

Sample Output #1

1 37896930 597086012 720637306 161940419 360472177 560327751 446560856 524295016

Sample Input #2

4 1
1 1 0 0

Sample Output #2

1 1 0 0

Sample Input #3

4 2
1 1 0 0

Sample Output #3

1 2 1 0

Sample Input #4

4 3
1 1 0 0

Sample Output #4

1 3 3 1

Notes

For $100\%$ of the data, $1 < n \leq 10^5$, $0 < k \leq 10^{10^5}$, $a_i \in [0, 998244352]$, and $a_0 = 1$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
9 18948465 1 2 3 4 5 6 7 8 9
样例输出
1 37896930 597086012 720637306 161940419 360472177 560327751 446560856 524295016