Guest User

Untitled

a guest
Feb 19th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. var n,x,y,i,p :longint; c :char;
  2.  
  3. begin
  4. readln(n,x,y);
  5. p:=1000;
  6. for i:=1 to n do
  7. begin
  8. read(c);
  9. if c='D'
  10. then p:=p-1
  11. else if c='L'
  12. then p:=p+1
  13. else
  14. case p mod 4 of
  15. 0: x:=x+1;
  16. 1: y:=y+1;
  17. 2: x:=x-1;
  18. 3: y:=y-1;
  19. end;
  20. end;
  21. writeln(x,' ',y);
  22. end.
Add Comment
Please, Sign In to add comment