- 分享
- 2009-10-24 19:56:54 @
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 56ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:运行超时...
├ 测试数据 09:运行超时|无输出...
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Unaccepted 有效得分:80 有效耗时:56ms
....那啥,为啥又有“运行超时... ”又有“运行超时|无输出... ”- -
var
i,j,k,w,s,d,p,z:longint;
k2,try,sum:array[1..200]of longint;
ok:boolean;
procedure born(z:longint);
var i,j:longint;
begin
fillchar(k2,sizeof(k2),0);k2[1]:=1;p:=1;
for i:=2 to z do begin
for j:=1 to p do k2[j]:=k2[j]*i;
for j:=1 to p-1 do begin
k2[j+1]:=k2[j+1]+k2[j]div 10;
k2[j]:=k2[j]mod 10;end;
while k2[p]>0 do begin
k2[p+1]:=k2[p]div 10;k2[p]:=k2[p]mod 10;inc(p);end;
dec(p);
end;
end;
procedure chu(x:longint);
var i,j:longint;
begin
try:=k2;
for i:=2 to x do begin
for j:=p downto 2 do begin
try[j-1]:=try[j-1]+try[j]mod i*10;
try[j]:=try[j] div i;end;
try[1]:=try[1]div i;
end;
for i:=2 to z-x do begin
for j:=p downto 2 do begin
try[j-1]:=try[j-1]+try[j]mod i*10;
try[j]:=try[j] div i;end;
try[1]:=try[1]div i;
end;
end;
begin
readln(k,w);
if k=1 then begin writeln(0);halt;end;
z:=1 shl k-1;
s:=w div k;d:=w mod k;
born(z);
for i:=2 to s+1 do begin
chu(i);
for j:=1 to p do sum[j]:=sum[j]+try[j];
for j:=1 to p-1 do begin
sum[j+1]:=sum[j+1]+sum[j]div 10;
sum[j]:=sum[j]mod 10;end;
end;
z:=1 shl k-1 shl d;
born(z);chu(s+1);
for i:=1 to p do sum[i]:=sum[i]-try[i];
for i:=1 to p-1 do begin
sum:=sum+(sum[i]+10)div 10-1;
sum[i]:=(sum[i]+10)mod 10;end;
p:=200;while sum[p]=0 do dec(p);
for i:=p downto 1 do write(sum[i]);
end.
1 条评论
-
zhc105 LV 9 @ 2009-10-24 19:56:55
可以尝试在后面加个writeln
- 1