我是看了题解之后写的,但不知道哪里错了,和样例似乎一模一样
#include <bits/stdc++.h>
using namespace std;
long long a[505];
long long pow_2(int w){
long long res=1;
for(int i=1;i<=w;i++) res*=2;
return res;
}
int main(){
int p;
cin>>p;
cout<<ceil(p*log10(2))<<endl;
a[1]=1;
long long tmp=pow_2(32);
int k1=p/32;
int k2=p%32;
for(int i=1;i<=k1;i++){
for(int j=1;j<=500;j++){
a[j]*=tmp;
}
for(int j=1;j<=500;j++){
a[j+1]+=a[j]/10;
a[j]%=10;
}
}
for(int i=1;i<=k2;i++){
for(int j=1;j<=500;j++){
a[j]*=2;
}
for(int j=1;j<=500;j++){
a[j+1]+=a[j]/10;
a[j]%=10;
}
}
a[1]--;
for(int i=500;i>=1;i--){
cout<<a[i];
}
return 0;
}