View Code of Problem 135

#include <stdio.h>
#include <string.h>
using namespace std;
int main(){
	int M;
	while( ~scanf("%d", &M)){
		char c[10];
		int t,sum;
		int m1=0,m2=0;
		int x,y;
		for( int i=0; i<M; i++ ){
			scanf("%s", &c);
			sum = 0;
			for( int j=1;j<strlen(c); j++ ){
				sum = sum*10+(c[j]-'0');
			}
			if( c[0] == 'L') m1 -= sum;
			if( c[0] == 'R') m1 += sum;
			if( c[0] == 'F') m2 += sum;
			if( c[0] == 'B') m2 -= sum;
		}
		scanf("%d%d", &x, &y );
		if( m1 == x && m2 == y ){
			printf("MEME IS SO LUCKY\n");
		}else{
			printf("GPS ERROR\n");
		}
	}

	return 0;
	
}

Double click to view unformatted code.


Back to problem 135