Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var n,x,y,i,p :longint; c :char;
- begin
- readln(n,x,y);
- p:=1000;
- for i:=1 to n do
- begin
- read(c);
- if c='D'
- then p:=p-1
- else if c='L'
- then p:=p+1
- else
- case p mod 4 of
- 0: x:=x+1;
- 1: y:=y+1;
- 2: x:=x-1;
- 3: y:=y-1;
- end;
- end;
- writeln(x,' ',y);
- end.
Add Comment
Please, Sign In to add comment