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