记录编号 | 160076 | 评测结果 | AAAAAAAAAA | ||
---|---|---|---|---|---|
题目名称 | [NOIP 2012]摆花 | 最终得分 | 100 | ||
用户昵称 | 是否通过 | 通过 | |||
代码语言 | C++ | 运行时间 | 0.010 s | ||
提交时间 | 2015-04-23 19:09:49 | 内存使用 | 0.35 MiB | ||
#include <fstream> using namespace std; ifstream input ("flower.in"); ofstream output ("flower.out"); int n,m,z[102],i,k,js[101][101],p,j,a; int main () { for(i=0;i<=100;i++) for(j=0;j<=100;j++) js[i][j]=0; input>>n>>m; for(i=1;i<=n;i++) input>>z[i]; for(i=0;i<=z[1];i++) js[1][i]=1; for(i=2;i<=n;i++) { for(j=0;j<=m;j++) { if(z[i]>j) k=j; else k=z[i]; for(p=0;p<=k;p++) { js[i][j]+=js[i-1][j-p]; js[i][j]%=1000007; } } } output<<js[n][m]%1000007; input.close(); output.close(); return 0; }