Zinuo_zheng @ 2023-08-17 11:26:18
#include<bits/stdc++.h>
using namespace std;
int a[505] = {1, 1};
void cal()
{
for(int i = 1; i <= a[0]; i++)
a[i] *= 2;
for(int i = 1; i <= a[0]; i++)
a[i + 1] += a[i] / 10, a[i] %= 10;
if(a[0] < 500 && a[a[0] + 1]) a[0]++;
}
int main()
{
int n;
scanf("%d", &n);
printf("%d", int(log10(2) * n) + 1);
for(int i = 1; i <= n; i++)
cal();
a[1]--;
for(int i = 500; i; i--)
{
if(i % 50 == 0) puts("");
printf("%d", a[i]);
}
return 0;
}
by Perfect_Youth @ 2023-08-17 11:31:35
@Zinuo_zheng 要快速幂,不然TLE