View Code of Problem 135

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,x0,y0,x,y,i;
	while(cin>>n){
		x=0,y=0;
		char c;int s;
		for(int i=0;i<n;i++){
			scanf("%c%d",&c,&s);
			if(c=='L'){
				x-=s;
			}
			else if(c=='R'){
				x+=s;
			}
			else if(c=='F'){
				y+=s;
			}
			else if(c=='B'){
				y-=s;
			}
		}
		scanf("%d%d",&x0,&y0);
		if(x==x0&&y==y0)
			printf("MEME IS SO LUCKY\n");
		else
			printf("GPS ERROR\n"); 
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 135