1 //大数问题
2 #include<iostream>
3 #include<stdio.h>
4 #include<string.h>
5 using namespace std;
6 int N, len;
7 int ans[10100];
8 int main()
9 {
10 while (scanf("%d", &N) != EOF) {
11 memset(ans, 0, sizeof(ans));
12 len = 0;
13 ans[0] = 1;
14 for (int i = 1; i <= N; ++i) {
15 for (int j = 0; j <= len; ++j)
16 ans[j] *= 2;
17 ans[0]++;
18 for (int j = 0; j <= len; ++j)
19 if (ans[j] > 9) {
20 ans[j + 1] += ans[j] / 10;
21 ans[j] %= 10;
22 }
23 if (ans[len + 1])
24 len++;
25 }
26 while (len >= 0) {
27 printf("%d", ans[len]);
28 len--;
29 }
30 printf("\n");
31 }
32 }
2 #include<iostream>
3 #include<stdio.h>
4 #include<string.h>
5 using namespace std;
6 int N, len;
7 int ans[10100];
8 int main()
9 {
10 while (scanf("%d", &N) != EOF) {
11 memset(ans, 0, sizeof(ans));
12 len = 0;
13 ans[0] = 1;
14 for (int i = 1; i <= N; ++i) {
15 for (int j = 0; j <= len; ++j)
16 ans[j] *= 2;
17 ans[0]++;
18 for (int j = 0; j <= len; ++j)
19 if (ans[j] > 9) {
20 ans[j + 1] += ans[j] / 10;
21 ans[j] %= 10;
22 }
23 if (ans[len + 1])
24 len++;
25 }
26 while (len >= 0) {
27 printf("%d", ans[len]);
28 len--;
29 }
30 printf("\n");
31 }
32 }