怎么会超时呢?

P1255 数楼梯

AnCcat @ 2017-04-09 17:23:36

var a,b,c:array[0..5000] of longint;
n,i,j,k:longint;
begin
readln(n);
if n=0 then
begin
writeln(0);
halt;
end;
if n=1 then
begin
writeln(1);
halt;
end;
if n=2 then
begin
writeln(2);
halt;
end;
a[1]:=1;
b[1]:=2;
for i:=3 to n do
begin
k:=0;
for j:=1 to 5000 do
begin
c[j]:=a[j]+b[j]+c[j];
c[j+1]:=c[j+1]+c[j] div 10;
c[j]:=c[j] mod 10;
end;
a:=b;
b:=c;
fillchar(c,sizeof(c),0);
end;
k:=5000;
while b[k]=0 do dec(k);
for i:=k downto 1 do write(b[i]);
end.
求助大神~

by AnCcat @ 2017-04-09 17:24:35

请大神们帮忙看看,哪错了?


by AnCcat @ 2017-04-09 17:35:23

最后一点超时


by Lolierl @ 2017-04-09 18:19:42

@赵书卉

你都绿名了,实在不行下个数据打表过不也行吗?

(我是C++党不懂pas,sorry)


by AnCcat @ 2017-04-24 19:11:36

谢谢,没事


by Hunterz @ 2017-04-30 09:36:13

操你妈


|