#include<iostream> using namespace std; int main() { int M, x,y, x0, y0; while(cin>>M) { string s[M]; x0=y0=0; for(int i=0; i<M; i++) { cin>>s[i]; if(s[i][0]=='L') { x0-=s[i][1]-'0'; }else if(s[i][0]=='R') { x0+=s[i][1]-'0'; }else if(s[i][0]=='F') { y0+=s[i][1]-'0'; }else if(s[i][0]=='B'){ y0-=s[i][1]-'0'; } } cin>>x>>y; if(x0==x&&y0==y) cout<<"MEME IS SO LUCKY"<<endl; else cout<<"GPS ERROR"<<endl; } } |
Double click to view unformatted code.