View Code of Problem 135

#include<iostream>
using namespace std;
int main(){
	int n,x = 0,y = 0;
	while(scanf("%d",&n) != EOF){
		char ch;
		int d;
		for(int i = 0;i<n;i++){
			getchar();
			scanf("%c%d",&ch,&d);
			if(ch == 'L') x -= d;
			else if(ch == 'R') x += d;
			else if(ch == 'B') y -= d;
			else if(ch == 'F') y += d;
			
		}
		int px,py;
		scanf("%d%d",&px,&py);
		if(x == px&&y == py) printf("MEME IS SO LUCKY\N");
		else printf("GPS ERROR\N");
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 135