#P5394. 【模板】下降幂多项式乘法
【模板】下降幂多项式乘法
Background
This is a template problem, with no background.
Problem Description
Given a degree falling factorial polynomial and a degree falling factorial polynomial , you need to compute a degree falling factorial polynomial such that .
Since the result can be very large, output the coefficients of the polynomial modulo .
Input Format
The first line contains two positive integers , representing the degrees of the falling factorial polynomials.
The second line contains non-negative integers , representing the coefficients of . That is, $A(x)=a_0+a_1x+a_2x^{\underline 2}+\dots+a_nx^{\underline n}$.
The third line contains non-negative integers , representing the coefficients of . That is, $B(x)=b_0+b_1x+b_2x^{\underline 2}+\dots+b_mx^{\underline m}$.
Output Format
Output one line with non-negative integers, representing the coefficients of modulo .
2 3
1 2 3
1 2 3 4
1 8 52 148 89 12
Hint
For of the testdata, .
For of the testdata, , , and .
$x^{\underline n}=\left\{\begin{matrix}1 & n=0\\ x\times (x-1)^{\underline{n-1}} & n\geqslant 1 \end{matrix}\right.$
is a degree falling factorial polynomial in .
It is easy to prove that a degree falling factorial polynomial uniquely determines a degree polynomial. Therefore, the definition of the product of falling factorial polynomials is: take the product of the corresponding polynomials, and then convert it back to the corresponding falling factorial polynomial.
Translated by ChatGPT 5