View Code of Problem 135

#include <stdio.h>
#include<string.h>
int main(){
  int m;
  char a[101];
  while (scanf("%d",&m)!=EOF){
    int count1=0,count2=0;
    while(m--){
      scanf("%s",&a);
      int walk=0;
      for(int j=1;j<strlen(a);j++){
        walk=walk*10+(a[j]-'0');
      }

      if(a[0]=='L')
        count1-=walk;
      if(a[0]=='R')
        count1+=walk;
      if(a[0]=='F')
        count2+=walk;
      if(a[0]=='B')
        count2-=walk;
    }

    int x,y;
    scanf("%d%d",&x,&y);

    if(count1==x&&count2==y)
      printf("MEME IS SO LUCKY\n");
    else
      printf("GPS ERROR\n");
  }
  return 0;
}
//参考User:2015123170

Double click to view unformatted code.


Back to problem 135