You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
628 B
35 lines
628 B
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
|
|
const int N = 100010;
|
|
|
|
// 加法高精度
|
|
int a[N], b[N];
|
|
int al, bl;
|
|
void add(int a[], int &al, int b[], int &bl) {
|
|
int t = 0;
|
|
al = max(al, bl);
|
|
for (int i = 1; i <= al; i++) {
|
|
t += a[i] + b[i];
|
|
a[i] = t % 10;
|
|
t /= 10;
|
|
}
|
|
if (t) a[++al] = 1;
|
|
}
|
|
|
|
int main() {
|
|
int n;
|
|
cin >> n;
|
|
b[++bl] = 1;
|
|
|
|
for (int i = 1; i <= n; i++) {
|
|
add(a, al, a, al);
|
|
add(a, al, b, bl);
|
|
}
|
|
|
|
// 最后再乘以2
|
|
add(a, al, a, al);
|
|
|
|
for (int i = al; i; i--) cout << a[i];
|
|
return 0;
|
|
} |