View Code of Problem 135

#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
	
	long long int n;
	while (cin >> n)
	{
		int x = 0, y = 0;
		char z;
		int d;
		while (n--)
		{
			cin >> z >> d;
			if (z == 'L')
			{
				x -= d;
			}
			else if (z == 'R')
			{
				x += d;
			}
			else if (z == 'F')
			{
				y += d;
			}
			else if (z == 'B')
			{
				y -= d;
			}
		}
		long long int a, b;
		cin >> a >> b;
		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