是个DP套路题,以前也见过类似的明明,一开始写不出我好菜
#define int ll
const int mod=1e9+7;
int p[2010],f[2010],dp[2010][2010];
signed main()
{
int n;cin>>n;
rpp(i,n)
{
cin>>p[i];
f[i] = ((1 - p[i]) % mod + mod) % mod;
}
dp[0][0]=1;
for(int i=1;i<=n;++i)
{
dp[i][0]=( dp[i-1][0] * f[i] )%mod;
for(int j=1;j<=i;++j)
dp[i][j] = (dp[i-1][j-1]*p[i]%mod+dp[i-1][j]*f[i]%mod)%mod;
}
rep(i,n) cout<<dp[n][i]<<" ";
cout<<dp[n][n]<<endl;
return 0;
}