View Code of Problem 135

#include<stdio.h>
#include<string.h>
void main(){
	int m,i,j;  
	while(~scanf("%d",&m)){
		char str[100];
		int walk,move1=0,move2=0;
		for(i=0;i<m;i++){
			walk=0; 
			scanf("%s",str);
			for(j=1;j<strlen(str);j++){
				walk=walk*10+(str[j]-'0');
			}
			if(str[0]=='L')
				move1-=walk;
			else if(str[0]=='R') 
				move1+=walk;
			else if(str[0]=='F')
				move2+=walk;
			else 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