#include <bits/stdc++.h> #include <iostream> #include <cmath> #include <cstring> #include <algorithm> using namespace std; //除法一定要用double int main() { int n,num,k; while(scanf("%d",&n) != EOF && n <= 1000 && n >= 0) { int a[2] = {0}; string cz; for(int i = 0; i < n; i++) { cin >> cz; k = 0; num = 0; int len = cz.length(); for(int j = len - 1; j >= 1; j--) { num += (cz[j] - '0')*pow(10,k); k++; } if(cz[0] == 'L') { a[0] -= num; } else if(cz[0] == 'R') { a[0] += num; } else if(cz[0] == 'F') { a[1] += num; } else if(cz[0] == 'B') { a[1] -= num; } } int x, y; cin >> x >> y; if(x == a[0] && y == a[1]) { cout << "MEME IS SO LUCKY" << endl; } else { cout << "GPS ERROR" << endl; } } return 0; } |
Double click to view unformatted code.