View Code of Problem 135

#include <stdio.h>
#include<string.h>
void main(){
  int m;
  char str[100];
  int walk,move1,move2;
  while(scanf("%d",&m)!=EOF){
  	walk=0;move1=0;move2=0;
    	scanf("%s",str);
   	for(int i=0;i<m;i++){
    	  for(int j=1;j<strlen(str);j++){
    		walk = walk*10 + (str[j]-'0');
          }
    	  if(str[0]=='L')move1-=walk;
    	  if(str[0]=='R')move1+=walk;
    	  if(str[0]=='F')move2+=walk;
    	  if(str[0]=='B')move2-=walk;
       }
       int x,y;
       scanf("%d %d",&x,&y);
       if(move1==x&&move2==y)
   	 printf("MEME IS SO LUCKY\n");
       else
    	 printf("GPS ERROR\n");
  }
}

Double click to view unformatted code.


Back to problem 135