NTT那块还要再看一下。。。
#include <cstdio>
#include <iostream>
#include <cmath>
typedef long long ll;
const int NR = 1 << 22, g = 3, gi = 332748118, mod = 998244353;
using namespace std;
int n, m, rev[NR];
ll a[NR], b[NR],c[NR],d[NR];
ll quikpow(ll a, ll k)
{
ll res = 1;
while (k > 0)
{
if (k&1)res=res*a%mod;
a=a*a%mod;
k>>=1;
}
return res;
}
void NTT(ll *a,int n,int type){
for(int i=0;i<=n;++i){
if(i<rev[i])swap(a[i],a[rev[i]]);
}
for(int i=1;i<n;i<<=1){
ll gn=quikpow(type?g:gi,(mod-1)/(i<<1));
for(int j=0;j<n;j+=(i<<1)){
ll g0=1;
for(int k=0;k<i;++k,g0=g0*gn%mod){
ll x=a[j+k],y=g0*a[i+j+k]%mod;
a[j+k]=(x+y)%mod;
a[i+j+k]=(x-y+mod)%mod;
}
}
}
if(type==1)return ;
ll inv = quikpow(n, mod - 2);
//reverse(a+1,a+n);
for(int i=0;i<n;++i)a[i]=a[i]*inv%mod;
}
void cdq(int l,int r){
if(l==r)return;
int mid=(l+r)>>1;
cdq(l,mid);
int ttt=(r-l+1)<<1,len=1<<max((int)ceil(log2(ttt)),1);
for(int i=0;i<len;++i){
rev[i]=(rev[i>>1]>>1)|((i&1)<<(max((int)ceil(log2(ttt)),1)-1));
}
for(int i=0;i<len;++i)c[i]=d[i]=0;
for(int i=l;i<=r;++i)c[i-l]=a[i-l];
for(int i=l;i<=mid;++i)d[i-l]=b[i];
NTT(c,len,1);
NTT(d,len,1);
for(int i=0;i<len;++i)c[i]=c[i]*d[i]%mod;
NTT(c,len,0);
for(int i=mid+1;i<=r;++i)b[i]=(b[i]+c[i-l])%mod;
cdq(mid+1,r);
}
int main(){
scanf("%d",&n);
for(int i=1;i<n;++i)scanf("%lld",a+i);
b[0]=1;
cdq(0,n-1);
for(int i=0;i<n;++i)printf("%lld ",b[i]);
return 0;
}