Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Project1;
- {$APPTYPE CONSOLE}
- uses
- SysUtils;
- var
- x, y, route, a, n, i: integer;
- begin
- readln(x, y);
- readln(n);
- route := 1;
- //1 - вверх
- //2 - влево
- //3 - вниз
- //4 - впарво
- for i := 1 to n do
- begin
- read(a);
- case (a) of
- 2: inc(route, 2);
- 4: inc(route);
- 3: dec(route);
- end;
- case (route) of
- 1: inc(y);
- 2: inc(x);
- 3: dec(y);
- 4: dec(x);
- end;
- end;
- writeln(x, ' ', y);
- readln;
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment