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