#P6115. 【模板】整式递推
【模板】整式递推
Description
For an infinite sequence , it is known that for all ,
where each is a polynomial of degree at most .
Given the coefficients of all , and , find .
Since the answer may be very large, output it modulo .
Input Format
The first line contains three positive integers .
The second line contains non-negative integers, representing .
Then there are lines, each containing non-negative integers; line gives the coefficients of from low degree to high degree.
Output Format
Output one integer in one line, representing the answer.
5 2 1
1 0
998244352 0
998244352 1
998244352 1
44
233 2 3
1 0
998244352 0 0 0
0 998244349 4 0
0 8 998244337 8
193416411
114514 7 7
1 9 8 2 6 4 7
9 1 8 2 7 6 5 3
2 8 4 6 2 9 4 5
1 9 2 6 0 8 1 7
1 9 1 9 8 1 0 7
1 1 4 5 1 4 4 4
4 4 4 4 4 4 4 4
9 9 8 2 4 4 3 5
1 9 8 6 0 6 0 4
565704112
Hint
[Explanation of Sample 1]
Here the recurrence is . It is easy to compute that .
[Constraints]
For of the testdata, .
For of the testdata, , .
All inputs are no more than .
$\forall x \in [m,n] \cap \mathbb Z \text{ s.t. } P_0(x) \not \equiv 0 \pmod{998244353}$.
Welcome to join ’s fan group: 747262201.
Translated by ChatGPT 5
京公网安备 11011102002149号