ggpw_XNW @ 2023-12-16 16:26:42
#include<iostream>
using namespace std;
int p , a[500] , len = 1;
void pd()
{
for(int i=1;i<=p;i++)
{
a[500] *= 2;
for(int j=500;j>500-len;j--)
{
a[j-1] += a[j] / 10;
a[j] = a[j] % 10;
if(a[j-1]){len++;}
}
}
a[500] -= 1;
}
int main()
{
cin >> p;
a[500] = 1;
cout << len << endl;
pd();
for(int i=1;i<=500;i++)
{
cout << a[i];
if(i%50==0){cout << endl;}
}
return 0;
}
by jinglinbankemeng @ 2023-12-16 18:25:41
可以参考一下,我的代码!
by jinglinbankemeng @ 2023-12-16 18:25:52
https://www.luogu.com.cn/record/139738566