luogu#P5245. 【模板】多项式快速幂
【模板】多项式快速幂
Background
This is a template problem, with no background.
Problem Description
Given a polynomial of degree , find a polynomial modulo such that .
The coefficients of the polynomials are computed modulo .
Input Format
The first line contains two integers .
The next line contains integers, representing the coefficients of in order: .
Output Format
Output integers, representing the first coefficients of in order: . Each coefficient should be the smallest non-negative integer modulo .
9 18948465
1 2 3 4 5 6 7 8 9
1 37896930 597086012 720637306 161940419 360472177 560327751 446560856 524295016
4 1
1 1 0 0
1 1 0 0
4 2
1 1 0 0
1 2 1 0
4 3
1 1 0 0
1 3 3 1
Hint
For of the testdata, , , , and .
Translated by ChatGPT 5