5个测试点WA,5个测试点TLE,Help!!!
查看原帖
5个测试点WA,5个测试点TLE,Help!!!
989399
louzezhong20130517楼主2023/9/17 20:39
#include<bits/stdc++.h> 
using namespace std;
const long long N=1e5+100000-2;
long long a[N];
int main(){
	int n,len=1,s,cnt=0;
	cin>>n;
	int i,j,k;
	a[1]=1;
	for(i=1;i<=n;i++) 
	{
		for(j=1;j<=len;j++)
		{
			a[j]*=2;
		}
		for(j=1;j<=len;j++)
		{
			s=0;
			if(a[j]>9)
			{
				a[j+1]+=a[j]/10;
				a[j]%=10;
				s=max(s,j+1);
			}
		}
		len=max(len,s);
	}
	for(i=len;i>=1;i--)
	{
		cnt++;
	}
	cout<<cnt<<endl;
	for(i=500;i>=1;i--)
	{
		cout<<a[i];
		if(i%50==0&&i!=500)
		{
			cout<<endl;
		}
	}
	return 0;
}

Help.

2023/9/17 20:39
加载中...