View Code of Problem 135

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,x = 0,y = 0;
	while(scanf("%d",&n) != EOF){
		
		for(int i = 0;i < n;i++){
			char ch;
			int d;
			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