|
- #include<iostream>
- #include<cstdio>
- #include<cstring>
- #include<algorithm>
- #include<cmath>
- using namespace std;
- int p,a[100002],b[520];
- void su(int n)
- {
- int i,j;
- if(n==0)
- return;
- su(n/2);
- for(i=1;i<=500;i++)
- for(j=1;j<=500;j++)
- if(n%2==0)
- a[i+j-1]=a[i+j-1]+b[i]*b[j];
- else
- a[i+j-1]=a[i+j-1]+b[i]*b[j]*2;
- for(i=1;i<=500;i++)
- {
- b[i]=a[i]%10;
- a[i+1]=a[i+1]+a[i]/10;
- }
- memset(a,0,sizeof(a));
- }
- int main()
- {
- int i;
- scanf("%d",&p);
- b[1]=1;
- su(p);
- cout<<int((log(2)/log(10))*p+1)<<endl;
- for(i=500;i>1;i--)
- {
- printf("%d",b[i]);
- if(i%50==1)
- printf("\n");
- }
- printf("%d",b[1]-1);
- return 0;
- }
复制代码 |
|