Posted on 2009-04-19 22:28
superman 阅读(82)
评论(0) 编辑 收藏 引用 所属分类:
USACO
1 #include <iostream>
2
3 using namespace std;
4
5 int main()
6 {
7 freopen("nocows.in", "r", stdin);
8 freopen("nocows.out", "w", stdout);
9
10 int n, m;
11 int cnt[100][200] = { 0 };
12
13 cin >> n >> m;
14
15 for (int i = 1; i <= m; i++)
16 cnt[i][1] = 1;
17
18 for (int i = 2; i <= m; i++)
19 for (int j = 3; j <= n; j += 2)
20 for (int k = 1; k <= j - 2; k += 2)
21 cnt[i][j] = (cnt[i][j] + cnt[i - 1][k] * cnt[i - 1][j - k - 1]) % 9901;
22
23 cout << (cnt[m][n] - cnt[m - 1][n] + 9901) % 9901 << endl;
24
25 return 0;
26 }
27