View Code of Problem 135

#include<stdio.h>
#include<string.h>
int main()
{
	int m;
	while(scanf("%d",&m)!=EOF)
	{
		int x=0,y=0,x1,y1;char a[100000];
		for(int i=0;i<m;i++)
		{
			scanf("%s",a);
			int sum=0;
			for(int j=1;j<strlen(a);j++)
			{
				sum=sum*10+(a[j]-'0');
			}
			if(a[0]=='L')
			{
				x-=sum;
			}
			if(a[0]=='R')
			{
				x+=sum;
			}
			if(a[0]=='F')
			{
				y+=sum;
			}
			if(a[0]=='B')
			{
				y-=sum;
			}		
		}
		scanf("%d %d",&x1,&y1);
		if(x==x1&&y1==y)
		{
			printf("MEME IS SO LUCKY\n");
		}
		else
		{
			printf("GPS ERROR\n");
		}
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 135