记录编号 |
324957 |
评测结果 |
AAAAAAAAAA |
题目名称 |
[NOIP 2012]摆花 |
最终得分 |
100 |
用户昵称 |
rewine |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.011 s |
提交时间 |
2016-10-18 21:31:05 |
内存使用 |
0.50 MiB |
显示代码纯文本
- #include <iostream>
- #include <cstdio>
- #include <cstring>
- #include <algorithm>
- #include <cmath>
- #include <queue>
- #define mod 1000007
-
- using namespace std;
-
- int a[200],f[200][200];
- bool sg[200][200];
- int n,m;
-
- int dfs(int t,int x) {
- if(x==m) return 1;
- if(x>m) return 0;
- if(t>n) return 0;
- if(sg[t][x]) return f[t][x];
- sg[t][x] = 1;
- for (int i = 0; i <= a[t]; i++) {
- f[t][x] += dfs(t+1,x+i);
- }
- f[t][x] %= mod;
- return f[t][x];
- }
-
- int main()
- {
- freopen("flower.in","r",stdin);
- freopen("flower.out","w",stdout);
- ios::sync_with_stdio(false);
- cin>>n>>m;
- for (int i = 1; i <= n; i++)
- cin >> a[i];
- cout<<dfs(1,0);
- }