I DON'T KNOW WHY I GOT WA???HELLLLLLLP~~~~~PLEASE~~~~~
Послано
windy 29 май 2003 18:58
program windy;
var
a:array[0..11,0..11] of 0..1;
b:array[1..100,1..2] of 0..11;
n,i,x,y,minx,miny,j:integer;
procedure init;
begin
readln(n);
for i:= 1 to n do
begin
readln(x,y);
a[x,y]:=1;
if x<minx then begin
minx:=x;
miny:=y
end
else if (x=minx) and (y<miny) then miny:=y;
end;
end;
procedure work(i:integer);
begin
if i=n then writeln('.')
else begin
x:=b[i,1];
y:=b[i,2];
if a[x+1,y]=1 then begin
write('R');
j:=j+1;
a[x+1,y]:=0;
b[j,1]:=x+1;
b[j,2]:=y;
end;
if a[x,y+1]=1 then begin
write('T');
j:=j+1;
a[x,y+1]:=0;
b[j,1]:=x;
b[j,2]:=y+1;
end;
if a[x-1,y]=1 then begin
write('L');
j:=j+1;
a[x-1,y]:=0;
b[j,1]:=x-1;
b[j,2]:=y;
end;
if a[x,y-1]=1 then begin
write('B');
j:=j+1;
a[x,y-1]:=0;
b[j,1]:=x;
b[j,2]:=y-1;
end;
write(',');
writeln;
work(i+1)
end
end;
begin
minx:=20;
miny:=20;
fillchar(a,sizeof(a),0);
fillchar(b,sizeof(b),0);
init;
b[1,1]:=minx;
b[1,2]:=miny;
writeln(minx,' ',miny);
j:=1;
a[minx,miny]:=0;
work(1);
end.