var
fx:1..4;
z:boolean;
xx,yy:string;
x,y,l:longint;
n,i,j,m:integer;
a,s:array[1..500]of string;
begin
fx:=1;
z:=false;
x:=0;
y:=0;
m:=0;
i:=0;
readln(n);
while i<=n do begin
inc(i);
readln(a[i]);
for j:=1 to length(a[i]) do if a[i][j]= then delete(a[i],j,1);
if a[i]<> then begin
if a[i]=left then
case fx of
4:fx:=1;
1,2,3:fx:=fx+1;
end
else if a[i]=right then
case fx of
1:fx:=4;
2,3,4:fx:=fx-1;
end
else begin
val(a[i],l);
if l<>0 then begin
z:=true;
case fx of
1:y:=y+l;
2:x:=x-l;
3:y:=y-l;
4:x:=x+l;
end;
inc(m);
str(x,xx);
str(y,yy);
s[m]:=(+xx+,+yy+);
end
else dec(i);
end;
end;
end;
if z=false then write((0,0))
else begin
for i:=1 to m-1 do writeln(s[i]);
write(s[m]);
end;
end.
测试结果1: 测试结果错误.错误结果为:
(0,-5)
(0,0)
(0,5)
正确结果应为:
(0,-5)
(5,-5)
(10,-5)
测试结果5: 测试结果错误.错误结果为:
(0,-3591)
(0,-7901)
(0,-7947)
(0,-11457)
(0,-20916)
(-8834,-20916)
(-8834,-18983)
(-11324,-18983)
正确结果应为:
(0,-3591)
(0,-7901)
(0,-7947)
(0,-11457)
(0,-20916)
(0,-12082)
(1933,-12082)
(1933,-9592)