import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
int x,y,n,m;
x=y=n=m=0;
int t,dir;
while(true){
t=scanner.nextInt();
dir=scanner.nextInt();
switch(n){
case 0:y+=(t-m)*10;break;
case 1:x-=(t-m)*10;break;
case 2:y-=(t-m)*10;break;
case 3:x+=(t-m)*10;break;
}
if(dir==3) break;
else if(dir==1) n++;
else n--;
n=(n+4)%4;
m=t;
}
System.out.println(x+" "+y);
}
}
ZZULIOJ 1070: 小汽车的位置 JAVA
![](https://img-home.csdnimg.cn/images/20240711042549.png)