#include<stdio.h> #include<math.h> int main(){ int i,step,n,x,y,mdx,mdy; char rention; while(scanf("%d",&n)!=EOF){ x=0;y=0; for(i=0;i<n;i++){ getchar(); scanf("%c%d",&rention,&step); if(rention=='L'){ x=x-step; }else if(rention=='F'){ y=y+step; }else if(rention=='R'){ x=x+step; }else if(rention=='B'){ y=y-step; } } scanf("%d %d",&mdx,&mdy); if(x==mdx&&y==mdy){ printf("MEME IS SO LUCKY\n"); }else{ printf("GPS ERROR\n"); } } return 0; } |
Double click to view unformatted code.