比赛 2025.1.4 评测结果 AAAAAAAAAA
题目名称 麦森数 最终得分 100
用户昵称 flyfree 运行时间 0.126 s
代码语言 C++ 内存使用 3.42 MiB
提交时间 2025-01-04 14:27:54
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double 
// By flyfreemrn
inline ll read(){
	ll x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=x*10+c-'0';
		c=getchar();
	}
	return x*f;
}
inline void write(ll x){
	if(x>9)write(x/10);
	putchar(x%10+'0');
}
ll p;
ll ans[1010],bas[1010],now[1010];
void multi_ans(){
	for(int i=1;i<=500;i++){
		for(int j=1;j<=500;j++){
			now[i+j-1]+=ans[i]*bas[j];
		}
	}
	for(int i=1;i<=500;i++){
		ans[i]=now[i]%10;
		now[i+1]+=now[i]/10;
		now[i]=0;
	}
}
void multi_bas(){
	for(int i=1;i<=500;i++){
		for(int j=1;j<=500;j++){
			now[i+j-1]+=bas[i]*bas[j];
		}
	}
	for(int i=1;i<=500;i++){
		bas[i]=now[i]%10;
		now[i+1]+=now[i]/10;
		now[i]=0;
	}
}
int main(){
	freopen("mason.in","r",stdin);
	freopen("mason.out","w",stdout);
	p=read();
	cout<<(ll)(p*log10(2))+1;
	ans[1]=1,bas[1]=2;
	while(p){
		if(p&1)multi_ans();
		multi_bas();
		p/=2;
	}
	for(int i=500;i>1;i--){
		if(i%50==0)cout<<endl;
		cout<<ans[i];
	}
	cout<<ans[1]-1;
	return 0;
}
/*
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000104079321946643990819252403273640855
38615262247266704805319112350403608059673360298012
23944173232418484242161395428100779138356624832346
49081399066056773207629241295093892203457731833496
61583550472959420547689811211693677147548478866962
50138443826029173234888531116082853841658502825560
46662248318909188018470682222031405210266984354887
32958028878050869736186900714720710555703168729087

00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000104079321946643990819252403273640855
38615262247266704805319112350403608059673360298012
23944173232418484242161395428100779138356624832346
49081399066056773207629241295093892203457731833496
61583550472959420547689811211693677147548478866962
50138443826029173234888531116082853841658502825560
46662248318909188018470682222031405210266984354887
32958028878050869736186900714720710555703168729087
*/