View Code of Problem 135

#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
 
 
int main()
{
	char c;
	int sum,n;
	while(scanf("%d",&n) != EOF)
	{
		int x = 0, y = 0;
		for(int i = 0; i < n; i++)
		{
			cin >> c >> sum;
			if(c == 'L')
			{
				x -= sum;	
			}	
			else if(c == 'R')
			{
				x += sum;
			}
			else if(c == 'F')
			{
				y += sum;
			}
			else if(c == 'B')
			{
				y -= sum;
			}
		}
		int x1,y1;
		cin >> x1 >> y1;
		if(x == x1 && y == y1)
		{
			cout << "MEME IS SO LUCKY" <<endl;
		}
		else
		{
			cout << "GPS ERROR" << endl; 
		}
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 135