普通多项式转下降幂多项式
由斯特林数基本性质,有
x n = ∑ i = 0 n i ! ( x i ) S ( n , i ) = ∑ i = 0 n S ( n , i ) x i ‾ x^n = \sum_{i = 0}^ni!\binom{x}{i}S(n,i) = \sum_{i = 0}^nS(n,i)x^{\underline{i}} xn=i=0∑ni!(ix)S(n,i)=i=0∑nS(n,i)xi
所以
∑ i = 0 n a i x i = ∑ i = 0 n a i ∑ j = 0 i S ( i , j ) x j ‾ = ∑ i = 0 n x i ‾ ∑ j = i n a j S ( j , i ) \sum_{i = 0}^na_ix^i = \sum_{i = 0}^na_i\sum_{j = 0}^iS(i,j)x^{\underline{j}} = \sum_{i = 0}^nx^{\underline{i}}\sum_{j = i}^na_jS(j,i) i=0∑naixi=i=0∑naij=0∑iS(i,j)xj=i=0∑nxij=i∑najS(j,i)
又 j < i j < i j<i时 S ( j , i ) = 0 S(j,i) = 0 S(j,i)=0,故 j j j可以从 0 0 0开始枚举,问题转化为求
b i = ∑ j = 0 n a j S ( j , i ) b_i = \sum_{j = 0}^na_jS(j,i) bi=j=0∑najS(j,i)
将
S ( n , m ) = 1 m ! ∑ i = 0 m ( − 1 ) i ( m i ) ( m − i ) n = ∑ i = 0 m ( − 1 ) i i ! ( m − i ) n ( m − i ) ! S(n,m) = \frac{1}{m!}\sum_{i = 0}^m(-1)^i\binom{m}{i}(m - i)^n = \sum_{i = 0}^m\frac{(-1)^i}{i!}\frac{(m - i)^n}{(m - i)!} S(n,m)=m!1i=0∑m(−1)i(im)(m−i)n=i=0∑mi!(−1)i(m−i)!(m−i)n
带入,得
b i = ∑ j = 0 n a j ∑ k = 0 i ( − 1 ) k k ! ( i − k ) j ( i − k ) ! = ∑ j = 0 i ( − 1 ) j j ! ∑ k = 0 n a k ( i − j ) k ( i − j ) ! b_i = \sum_{j = 0}^na_j\sum_{k = 0}^i\frac{(-1)^k}{k!}\frac{(i - k)^j}{(i - k)!} = \sum_{j = 0}^i\frac{(-1)^j}{j!}\sum_{k = 0}^na_k\frac{(i - j)^k}{(i - j)!} bi=j=0∑najk=0∑ik!(−1)k(i−k)!(i−k)j=j=0∑ij!(−1)jk=0∑nak(i−j)!(i−j)k
显然为卷积式。注意到 k k k只在下标和指数位置上出现,设 g ( x ) = ∑ i = 0 n a i x i g(x) = \sum_{i = 0}^na_ix^i g(x)=∑i=0naixi,则可以通过多点求值算出 g ( 0 ) , g ( 1 ) , ⋯ g ( n ) g(0),g(1),\cdots g(n) g(0),g(1),⋯g(n)的值,最后直接卷积计算 b b b即可。
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
const int maxn = 1e5 + 50,maxm = 2.63e5,mod = 998244353,g = 3;
int n,N,a[maxn],rev[maxm],F[maxm],G[maxm],T[maxm],T1[maxm],T2[maxm],W[20][maxm],inv_W[20][maxm],inv[maxm];
vector <int> P[4 * maxn];
int read(){
int x = 0;
char c = getchar();
while(c < '0' || c > '9') c = getchar();
while(c >= '0' && c <= '9') x = x * 10 + (c ^ 48),c = getchar();
return x;
}
inline int add(int x,int y){
if(x + y < mod) return x + y;
else return x + y - mod;
}
inline int dec(int x,int y){
if(x - y >= 0) return x -