View Code of Problem 135

#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#define N 100
using namespace std;
int main()
{
	
	int t;
	while(scanf("%d",&t)!=EOF)
	{
		int x=0,y=0,m,n;
		while(t--)
		{
			getchar();
			char str[5];
			scanf("%s",&str);
			int k=0;
			for(int i=1;i<strlen(str);i++)
				k=k*10+str[i]-'0';
			if(str[0]=='L')
				x=x-k;
			else if(str[0]=='R')
				x=x+k;
			else if(str[0]=='F')
				y=y+k;
			else if(str[0]=='B')
				y=y-k;
		}
	//	printf("%d %d\n",x,y);
		scanf("%d %d",&m,&n);
		if(x==m&&y==n)
			printf("MEME IS SO LUCKY\n");
		else
			printf("GPS ERROR\n");
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 135