View Code of Problem 135

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

Double click to view unformatted code.


Back to problem 135