View Code of Problem 135

#include<bits/stdc++.h>
using namespace std;
int main(){
    int m;
    while(cin>>m){
        int x =0, y= 0;
        for(int i = 0; i<m; i++){
            string ste;
            cin>>ste;
            int c = stoi(ste.substr(1));
            if(ste[0]=='L'){
                x -= c;
            }
            if(ste[0]=='R'){
                x+=c;
            }
            if(ste[0]=='F'){
                y+=c;
            }
            if(ste[0]=='B'){
                y-=c;
            }
        }
        int nx, ny;
        cin>>nx>>ny;
        if(nx==x&&ny ==y){
            cout<<"MEME IS SO LUCKY"<<endl;
        }
        else{
            cout<<"GPS ERROR"<<endl;
        }
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 135