讨论 / 第四个点超时?
Norson 2008-06-12 01:36:00
点我顶贴 收藏 删除
var s:string;

n,i,d,x,y,ss:longint;

begin

readln(n);

d:=1;

for i:=1 to n do

begin

readln(s);

case d of

1: if s=right then d:=2 else

if s=left then d:=4 else

begin

val(s,ss);

y:=y+ss;

writeln((,x,,,y,));

end;

2: if s=right then d:=3 else

if s=left then d:=1 else

begin

val(s,ss);

x:=x+ss;

writeln((,x,,,y,));

end;

3: if s=right then d:=4 else

if s=left then d:=2 else

begin

val(s,ss);

y:=y-ss;

writeln((,x,,,y,));

end;

4: if s=right then d:=1 else

if s=left then d:=3 else

begin

val(s,ss);

x:=x-ss;

writeln((,x,,,y,));

end;

end;

end;

end.

我只有一层循环,而且n<500

为什么第四个点会超时?得90分。

#1 Norson@2008-06-12 01:36:00
回复 删除
原来是无输出,不是超时。

早知道应该先看讨论再做的。

白交了两遍。

查看更多回复
提交回复