显示原始代码
#include <bits/stdc++.h>
using namespace std;
const int N = 502;
const int mod = 1e9;
short int a[N], b[N];
void opr() {
for (int i = 1; i <= 500; ++i) {
a[i] += b[i];
a[i + 1] += a[i] / 10;
a[i] %= 10;
b[i] *= 2;
}
for (int i = 1; i <= 500; ++i) {
b[i + 1] += b[i] / 10;
b[i] %= 10;
}
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
b[1] = 1;
int p, cnt = 0;
int twos = 1;
cin >> p;
for (int i = 1; i <= p; ++i) {
opr();
twos *= 2;
if (twos > mod) {
twos /= 10;
++cnt;
}
}
while (twos) {
twos /= 10;
++cnt;
}
cout << cnt;
for (int i = 9; i >= 0; --i) {
cout << "\n";
for (int j = 50; j >= 1; --j) {
cout << a[i * 50 + j];
}
}
return 0;
}