View Code of Problem 135

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    while (cin>>n)
    {
        int x0 = 0, y0 = 0;
        char ch;
        int a;
        for (int i = 0; i < n; i++)
        {
            cin >> ch >> a;
            if (ch == 'L')
            {
                x0 -= a;
            }
            else if (ch == 'R')
            {
                x0 += a;
            }
            else if (ch == 'B')
            {
                y0 -= a;
            }
            else
            {
                y0 += a;
            }

        }
        int x, y;
        cin >> x >> y;
        if (x == x0 && y == y0)
        {
            cout << "MEME IS SO LUCKY" << endl;
        }
        else
        {
            cout << "GPS ERROR" << endl;
        }
    }
   
   

}

Double click to view unformatted code.


Back to problem 135