View Code of Problem 135

#include<stdio.h>
#include<string.h>
#include<math.h>
int main(){
	int n;
	while(scanf("%d",&n)!=EOF){
		int x=0,y=0,s,X,Y;
		char c;
		int i;
		for(i=0;i<n;i++){
			getchar();//注意
			scanf("%c",&c);
			scanf("%d",&s);
			switch(c){
				case 'L':x=x-s;break;
				case 'R':x=x+s;break;
				case 'F':y=y+s;break;
				case 'B':y=y-s;break;
			} 
		}
		scanf("%d %d",&X,&Y);
		if(x==X&&y==Y){
			printf("MEME IS SO LUCKY\n");
		}else{
			printf("GPS ERROR\n");
		}
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 135