1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| const int N=410,P=1e9+7;
int n,m; ll qpow(ll x,ll k=P-2){ ll res=1; for(;k;k>>=1,x=x*x%P) if(k&1) res=res*x%P; return res; } int C[N][N],F[N],D[N],I[N],J[N]; int dp[N][N];
int main(){ n=rd(),m=rd(); rep(i,0,N-1) rep(j,*C[i]=1,i) C[i][j]=(C[i-1][j]+C[i-1][j-1])%P; I[0]=I[1]=J[0]=J[1]=1; rep(i,2,N-1) { J[i]=1ll*J[i-1]*i%P; I[i]=1ll*(P-P/i)*I[P%i]%P; } D[0]=1; rep(i,1,min(m*2,n)) D[i]=1ll*D[i-1]*(n-i+1)%P*I[i]%P; rep(i,1,N-1) I[i]=1ll*I[i-1]*I[i]%P; dp[0][0]=1; rep(i,0,m) rep(j,0,i*2) if(dp[i][j]) rep(k,1,m-i) { dp[i+k][j+k+1]=(dp[i+k][j+k+1]+1ll*dp[i][j]*C[j+k][j]%P*J[k])%P; } rep(i,0,m) rep(j,0,i*2) if(dp[i][j]) F[i]=(F[i]+1ll*D[j]*dp[i][j])%P; rep(i,2,m) F[i]+=F[i-2],Mod1(F[i]); rep(i,1,m) printf("%d ",F[i]); }
|