SCma @ 2022-12-16 07:24:06
#include<bits/stdc++.h>
using namespace std;
int sum[10003]={1};//高精度
int main(){
cin.tie();
cout.tie();
int p;
cin >> p;
cout << (int)(log10(2)*p+1) << endl;
int l_sum=1,jin=0;
for(int i=0;i<p;i++){
jin=0;
for(int j=0;j<l_sum;j++){
sum[j]=sum[j]*2+jin;//各位判断
jin=0;
if(sum[j]>9){
jin=sum[j]/10;
sum[j]%=10;
if(j+1>=l_sum) l_sum++;
}
if(l_sum>502){l_sum=501;}
}
}
for(int i=499;i>=0;i--){
if((499-i)%50==0&&i!=499) cout << endl;//换行
if(i==0){cout << sum[i]-1;break;}
cout << sum[i];
}
}
by co7ahang @ 2022-12-16 07:30:59
6
by joejoejoejoe @ 2022-12-16 09:34:49
这道题要用高精快速幂或压位高精,直接用高精乘肯定会TLE
by SCma @ 2022-12-16 10:41:06
@joejoejoe 谢谢大佬