Warspite @ 2017-01-16 19:34:33
var
p,ls,i,j,k1,k2:longint;
s:array[1..500] of byte;
begin
readln(p);
writeln(trunc(p*ln(2)/ln(10))+1);
s[1]:=1;
ls:=0;
for i:=1 to p do begin
ls:=ls+1;
if ls>500 then ls:=500;
k1:=0;
for j:=1 to ls do begin
k2:=s[j]*2+k1;
k1:=k2 div 10;
s[j]:=k2 mod 10;
end;
end;
s[1]:=s[1]-1;
for i:=500 downto 1 do begin
write(s[i]);
if (i-1) mod 50=0 then writeln;
end;
readln;
end.
by luaddict @ 2017-01-16 20:28:24
要用快速幂
by xixinyan111 @ 2017-01-21 21:38:08
不难
by Warspite @ 2017-01-24 19:50:59
哪位好心的能把代码发一下,PASCAL,C++都行
by Joyee—Jin @ 2017-03-12 19:56:10
#include<bits/stdc++.h>
using namespace std;
long long n,i,j,a[501];
int main()
{
cin>>n;
cout<<floor(log(2)/log(10)*n+1)<<endl;
a[0]=1;
for(i=0;i<n-55;i=i+55)
{
for(j=0;j<501;j++){if(a[j]==0){continue;}a[j]=a[j]*36028797018963968;}
for(j=0;j<501;j++){if(a[j]>9){a[j+1]=a[j+1]+a[j]/10,a[j]=a[j]%10;}}//进位
}
for(;i<n;i++)//剩下的也要乘下去……
{
for(j=0;j<501;j++){if(a[j]==0){continue;}a[j]=a[j]*2;}
for(j=0;j<501;j++){if(a[j]>9){a[j+1]=a[j+1]+a[j]/10,a[j]=a[j]%10;}}
}
for(i=499;i>0;i--){cout<<a[i];if(i%50==0){cout<<endl;}}
cout<<a[0]-1;//因为要-1,单独输出
return 0;
}
by Joyee—Jin @ 2017-03-12 19:56:48
题解就有
by Warspite @ 2017-03-17 15:46:59
抄题解
by Warspite @ 2017-03-17 15:47:38
@060819hehe 抄题解
by SWWWWWWWWWind @ 2017-04-15 14:41:05
by Joyee—Jin @ 2017-05-15 21:43:17
@ lshsc
2017年1月8日 因暴刷题而绿名
2017年1月21日 因写题解而橙名
还说我呢?暴刷题还不知道抄了多少题解呢