View Code of Problem 135

#include <iostream>
using namespace std;
int n;
int main(){
	while(cin>>n){
		int a=0,b=0;
		while(n--){
			string s;
			cin>>s;
			int k=s[1]-'0';
			if(s[0]=='L'){
				a-=k;
			}
			else if(s[0]=='R')
				a+=k;
			else if(s[0]=='B')
				b-=k;
			else if(s[0]=='F')
				b+=k;
		}
		int x,y;
		cin>>x>>y;
		if(x==a&&y==b)
			cout<<"MEME IS SO LUCKY"<<endl;
		else
			cout<<"GPS ERROR"<<endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 135