1070: 小汽车的位置
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);int x,y,flag,c,time,command;x=y=flag=c=0;while(cin.hasNextInt()){
time=cin.nextInt();command=cin.nextInt();switch(flag){
case 0:y+=(time-c)*10;break;case 1:x-=(time-c)*10;break;case 2:y-=(time-c)*10;break;case 3:x+=(time-c)*10;break;}if(command==3) break;if(command==1) flag++;if(command==2) flag--;flag=(flag+4)%4;c=time;}System.out.printf("%d %d\n",x,y);}
}