过样例了,0蛋
查看原帖
过样例了,0蛋
244502
_Stay_楼主2022/4/8 17:24
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[55500],jw;
int main()
{
	long long int b,p,s=1;
	cin>>b;
	a[1]=1;
	for(int i=1;i<=b;i++)
	{
		for(int j=1;j<=s;j++)
		{
			a[j]*=2;
		}
		for(int j=1;j<=s;j++)
		{
			if(a[j]>=10)
			{
				a[j+1]++;
				a[j]-=10;
				if(j==s)
				{
					jw++;
				}
			}
		}
		if(jw==1)
		{
			s++;
			jw=0;
		}
		if(s>500)
		{
			for(int i=500;i<=s;i++)
			{
				a[i]=0;
			}
			s=500;
		}
	}
	int w=500;
	while(a[w]==0)
	{
		w--;
	}
	cout<<w<<endl;
	for(int i=500;i>=1;i--) cout<<a[i];
	return 0;
}
2022/4/8 17:24
加载中...