View Code of Problem 135

#include<stdio.h>
#include<math.h>
#include<string.h>
#include<ctype.h>
#include<stdlib.h>
int main()
{
	int m,x,y;
	while(scanf("%d",&m)!=EOF)
	{
		int a=0,b=0,t;
		char ch;
		while(m--)
		{
			getchar();
			scanf("%c%d",&ch,&t);
			if(ch=='L') a=a-t;
			if(ch=='R') a=a+t;
			if(ch=='F') b=b+t;
			if(ch=='B') b=b-t; 
		}
		scanf("%d%d",&x,&y);
		if(a==x&&b==y)
		printf("MEME IS SO LUCKY\n");
		else
		printf("GPS ERROR\n");
	
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 135