View Code of Problem 135

#include <stdio.h>
#include <string.h>

int main(){
	int m;
	while(scanf("%d",&m)!=EOF){
		char s[5];
		int lr=0;
		int fb=0;
		while(m--){
			getchar();
			scanf("%s",s);
			int j=s[1]-'0';
			for(int i=2;i<strlen(s);i++){
				j=j*10+s[i]-'0';
			}
			if(s[0]=='L'){
				lr-=j;
			}else if(s[0]=='R'){
				lr+=j;
			}else if(s[0]=='F'){
				fb+=j;
			}else if(s[0]=='B'){
				fb-=j;
			}
		}
		int x,y;
		scanf("%d %d",&x,&y);
		if(lr==x&&fb==y){
			printf("MEME IS SO LUCKY\n");
		}else{
			printf("GPS ERROR\n");
		}
	}
}

Double click to view unformatted code.


Back to problem 135