#P5383. Conversion to Falling Factorial Basis
Conversion to Falling Factorial Basis
Conversion to Falling Factorial Basis
Given a standard polynomial
\(F(x)=\displaystyle\sum_{i=0}^{n-1}a_i x^{i}\),
find the falling factorial representation
\(G(x)=\displaystyle\sum_{i=0}^{n-1}b_i x^{\underline{i}}\),
such that \(G(x)=F(x)\). Here the falling factorial is defined as
\(x^{\underline{i}}=x(x-1)\cdots (x-i+1)\) for \(i \ge 1\) with \(x^{\underline{0}}=1\).
All operations are performed modulo \(998244353\).
The relation between the power basis and the falling factorial basis is given by:
[ x^i=\sum_{j=0}^{i} S(i,j), x^{\underline{j}},]
where \(S(i,j)\) are the Stirling numbers of the second kind. Therefore, by comparing coefficients we have:
[ b_j = \sum_{i=j}^{n-1} a_i ; S(i,j) \quad (0 \le j < n).]
inputFormat
The first line contains a single integer \(n\) (\(1 \le n \le 10^3\)), representing the number of coefficients in the polynomial \(F(x)\).
The second line contains \(n\) space-separated integers \(a_0, a_1, \ldots, a_{n-1}\) where \(0 \le a_i < 998244353\), representing the coefficients of \(F(x)\) in the standard basis.
outputFormat
Output \(n\) space-separated integers \(b_0, b_1, \ldots, b_{n-1}\) where each \(b_j\) is the coefficient corresponding to \(x^{\underline{j}}\) in the falling factorial basis, computed modulo \(998244353\).
sample
1
5
5
</p>