View Code of Problem 135

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,x0,y0,x,y,i;
	while(cin>>n)
	{
		x=0,y=0;
		getchar();
		char c;
		int  s;
		for(i=0;i<n;i++)
		{
			cin>>c>>s;
			getchar(); 
			if(c=='L')
			x-=s;
			else if(c=='R')
			x+=s;
			else if(c=='F')
			y+=s;
			else if(c=='B')
			y-=s;
				}
				cin>>x0>>y0;
				
		if(x==x0&&y==y0)
		cout<<"MEME IS SO LUCKY"<<endl;
		else
		cout<<"GPS ERROR"<<endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 135