#include <stdio.h>
int main(void) {
int time1, time2;
int order;
int direction; //north = 2, west =3, south =4, east = 1
int x = 0, y = 0;
y = (time2 == 0)? 0 : 10 * time2;
time1 = time2;
do{
while(order == 1){
switch(direction){
case 2:
x = x -10 * (time2 - time1) ;
y = y ;
direction = 3;
time1 = time2;
break;
case 3:
x = x;
y = y - 10 * (time2 - time1);
direction = 4;
time1 = time2;
break;
case 4:
x = x + 10 * (time2 - time1);
y =y;
direction = 1;
time1= time2;
break;
case 1:
x = x;
y = y+ 10 * (time2 - time1);
direction = 2;
time1= time2;
break;
}
}
while (order == 2){
switch(direction){
case 2:
x = x + 10 * (time2 - time1) ;
y = y ;
direction = 1;
time1 = time2;
break;
case 3:
x = x;
y = y + 10 * (time2 - time1);
direction = 2;
time1 = time2;
break;
case 4:
x = x - 10 * (time2 - time1);
y =y;
direction = 3;
time1= time2;
break;
case 1:
x = x;
y = y- 10 * (time2 - time1);
direction = 4;
time1= time2;
break;
}
}
}while(order == 3);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbih2b2lkKSB7CmludCB0aW1lMSwgdGltZTI7CiAgICBpbnQgb3JkZXI7CiAgICBpbnQgZGlyZWN0aW9uOyAgLy9ub3J0aCA9IDIsIHdlc3QgPTMsIHNvdXRoID00LCBlYXN0ID0gMQogICAgaW50IHggPSAwLCB5ID0gMDsKc2NhbmYoIiVkIiwgJiB0aW1lMik7CnkgPSAodGltZTIgPT0gMCk/IDAgOiAxMCAqIHRpbWUyOwp0aW1lMSA9IHRpbWUyOwpkb3sKc2NhbmYoIiVkIiwgJiBvcmRlcik7CnNjYW5mKCIlZCIsICYgdGltZTIpOwp3aGlsZShvcmRlciA9PSAxKXsKIHN3aXRjaChkaXJlY3Rpb24pewpjYXNlIDI6CnggPSB4IC0xMCAqICh0aW1lMiAtIHRpbWUxKSA7CnkgPSB5ICA7CmRpcmVjdGlvbiA9IDM7CnRpbWUxID0gdGltZTI7CmJyZWFrOwogICAKICAgY2F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