View Code of Problem 135

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

int main(){
	int m,l,r,f,b;
	char w;
	int cnt,x,y;
	while(scanf("%d",&m)!=EOF){
	    l=0;
	    r=0;
	    f=0;
	    b=0;
	    for(int i=0;i<m;i++){
	        getchar();
	        scanf("%c%d",&w,&cnt);
	        switch(w){
	            case 'L':l+=cnt;break;
	            case 'R':r+=cnt;break;
	            case 'F':f+=cnt;break;
	            case 'B':b+=cnt;break;
	            default:break;
	        }
	    }
	    scanf("%d %d",&x,&y);
	    if(x==(r-l)&&y==(f-b)){
	        printf("MEME IS SO LUCKY\n");
	    }else{
	        printf("GPS ERROR\n");
	    }
	}
	return 0;
} 

Double click to view unformatted code.


Back to problem 135