View Code of Problem 135

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main (){
	int n, l, r;
	while(~scanf("%d", &n)){
		char ch;
		int s, x = 0, y = 0;
		while(n--){
			getchar();
			scanf("%c%d", &ch, &s);
			switch(ch){
				case 'L':
					x -= s;
					break;
				case 'R':
					x += s;
					break;
				case 'F':
					y += s;
					break;
				case 'B':
					y -= s;
					break;
			}
//			if(ch=='L') x = x-s;
//			if(ch=='R') x = x+s;
//			if(ch=='F') y = y+s;
//			if(ch=='B') y = y-s;
		}
		scanf("%d%d", &l, &r);
		if(x==l&&y==r) printf("MEME IS SO LUCKY\n");
		else printf("GPS ERROR\n");
	}

	return 0;
}

Double click to view unformatted code.


Back to problem 135