#include <stdio.h> #include <string.h> #include <math.h> int main(){ int m,s,x,y,x0,y0,len,index; char c,str[10]; //输入1:1个整数m,m个字符串,0<=m<=1000 while(scanf("%d", &m)!=EOF){ x=0; y=0; while(m--){ s=0; scanf("%s", str); len = strlen(str); c = str[0]; index=0; for(int i=len-1; i>=1; i--){ s = s + (str[i]-'0')*pow(10,index++); } if(c=='L'){ x-=s; }else if(c=='R'){ x+=s; }else if(c=='F'){ y+=s; }else if(c=='B'){ y-=s; } } //输入2:2个整数x0和y0 scanf("%d %d", &x0, &y0); if(x==x0 && y==y0) printf("MEME IS SO LUCKY\n", x, y); else printf("GPS ERROR\n", x, y); //处理 //输出:1行字符串 } } |
Double click to view unformatted code.