#include<iostream> #include<string> using namespace std; int main() { int m,x,y; string a[1000],b[1000]; while (cin >> m) { int l1=0 , r1=0 , f1=0 , b1 = 0; getchar(); for (int i = 0; i < m; i++) { getline(cin, a[i]); } cin >> x >> y; int walk = 0; int x1 = 0, y1 = 0; for (int i = 0; i < m; i++) { b[i] = a[i].substr(1, a[i].size() - 1); if (a[i][0] == 'L') { x1-= atoi(b[i].c_str()); } if (a[i][0] == 'R') { x1+= atoi(b[i].c_str()); } if (a[i][0] == 'F') { y1+= atoi(b[i].c_str()); } if (a[i][0] == 'B') { y1-= atoi(b[i].c_str()); } //a[i].substr(1, a[i].size()) - '0'; //walk=walk*10+(str[j]-'0') } if (x1== x && y1== y) cout << "MEME IS SO LUCKY"<<endl; else cout << "GPS ERROR" << endl; } return 0; } |
Double click to view unformatted code.