求助……为什么输出不对

P1077 [NOIP2012 普及组] 摆花

布吉鸟
by hanyuchen2019 @ 2020-03-26 13:06:55


您看看 ```cpp #include<bits/stdc++.h> using namespace std; const int maxn=101,mod = 1000007; int n,m,a[maxn],dp[maxn][maxn]; int main() { cin>>n>>m; for(int i=1; i<=n; i++) cin>>a[i]; dp[0][0] = 1;//dp(i,j)表示前i个数总和为j的方案数 for(int i=1; i<=n; i++) { for(int i2=0;i2<=m;i2++) { for(int i3=0;i3<=min(i2,a[i]);i3++) { dp[i][i2]=(dp[i][i2]+dp[i-1][i2-i3])%mod; } } } cout<<dp[n][m]<<endl; return 0; } ```
by PersistentLife @ 2020-03-26 13:14:46


|