View Code of Problem 135

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

Double click to view unformatted code.


Back to problem 135