#P5245. Polynomial Power Modulo x^n
Polynomial Power Modulo x^n
Polynomial Power Modulo x^n
Given a polynomial \(A(x)\) of degree \(n-1\), compute the polynomial \(B(x)\) such that
[ B(x) \equiv (A(x))^k \pmod{x^n}, ]
i.e. the first \(n\) coefficients of \(A(x)^k\) (with degree less than \(n\)) are required. All polynomial operations (addition and multiplication) are performed modulo 998244353.
Input: The first line contains two integers \(n\) and \(k\). The second line contains \(n\) space-separated integers representing the coefficients of \(A(x)\) from the constant term up to the \(x^{n-1}\) term.
Output: Output \(n\) space-separated integers representing the coefficients of \(B(x)\) from the constant term up to the \(x^{n-1}\) term.
inputFormat
The first line contains two integers, \(n\) and \(k\). The second line contains \(n\) integers: \(a_0, a_1, \dots, a_{n-1}\), which are the coefficients of the polynomial \(A(x)\) modulo 998244353.
outputFormat
Output \(n\) integers: \(b_0, b_1, \dots, b_{n-1}\), representing the coefficients of \(B(x) = (A(x))^k \) modulo \(x^n\) and modulo 998244353.
sample
4 2
1 2 3 4
1 4 10 20