View Code of Problem 135

#include<stdio.h>
#include<string.h>
int main(){
	int n;
	while(scanf("%d",&n)!=EOF){
		int x=0,y=0,s,x1,y1;
		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",&x1,&y1);
		if(x==x1&&y==y1){
			printf("MEME IS SO LUCKY\n");
		}else{
			printf("GPS ERROR\n");
		}
	}
	return 0;
} 

Double click to view unformatted code.


Back to problem 135