70分TLE哪位大佬帮忙调一下(TAT)
查看原帖
70分TLE哪位大佬帮忙调一下(TAT)
1119251
Lyz2013楼主2025/7/28 16:17
#include<bits/stdc++.h>
using namespace std;
int a[555],t=1;
int main(){
	int p; 
	cin>>p;
	int d=floor(p*log10(2))+1;
	cout<<d<<endl;
	a[1]=1;
	for(int i=1;i<=p;i++){
		for(int j=1;j<=t;j++) a[j]*=2;
		for(int j=1;j<=t;j++){
			a[j+1]+=a[j]/10;
			a[j]%=10;
		}
		if(a[t+1]!=0 && t<500) t++;
	}
	int s=0;
	a[1]-=1;
	for(int i=500;i>=1;i--){
		s++;
		cout<<a[i];
		if(s%50==0) cout<<endl;
	}
	return 0;
}

2025/7/28 16:17
加载中...