- 数的计数(加强版)
- 2009-10-23 11:45:43 @
状态页显示我P1136没有一个是AC
http://www.vijos.cn/Record.asp?userid=918&ProblemID=1136
但是事实上过题列表又有这个题
http://www.vijos.cn/User_Show.asp?id=918
2 条评论
-
SHUSHU LV 8 @ 2014-11-22 14:58:30
WEI SHE ME HUI CUO
-
2014-11-22 14:57:54@
var
i,n,j:longint;
k,m:int64;
a:array[0..1500000,1..3] of int64;
b:array[0..1500000] of 0..3;
begin
readln(n);
m:=9000000000000000000;
n:=n div 2;
a[0,1]:=1;
b[0]:=1;
for i:=1 to n do
begin
for j:=1 to b[i-1] do
begin
a[i,j]:=(a[i-1,j]+a[i div 2,j]+k) mod m;
k:=(a[i-1,j]+a[i div 2,j]+k) div m;
end;
if k=0 then b[i]:=b[i-1]
else begin b[i]:=b[i-1]+1;
a[i,j+1]:=k;
k:=0;
end;
end;
for i:=b[n] downto 1 do
write(a[n,i]);
end.
- 1