View Code of Problem 135

#include<stdio.h>
int main(){
	int m;
	while(scanf("%d",&m)!=EOF){
		int x=0,y=0;
		char a;
		int s;
		getchar();
		while(m--){
			scanf("%c%d",&a,&s);
			getchar();
			if(a=='L'){
				x = x - s;
			}else if(a=='R'){
				x = x + s;
			}else if(a=='F'){
				y = y + s;
			}else if(a=='B'){
				y = y - s;
			}
		}
		int i,j;
		scanf("%d %d",&i,&j);
		if(x==i&&y==j)
			printf("MEME IS SO LUCKY\n");
		else
			printf("GPS ERROR\n");
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 135