View Code of Problem 135

#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;
int parseInt(string a) {
	int num = 0;
	for (int i = 0; i < a.size(); ++i)
		num += (a[i] - '0')*pow(10, i);
	return num;
}
int main()
{
	// 左右抵消 上下抵消
	int m;
	char pos;
	int len;
	while (cin >> m) {
		//getchar();
		int x = 0, y = 0;
		int t = m;
		while (t--) {
			cin >> pos >> len;
			if (pos == 'L') x -= len;
			if (pos == 'R') x += len;
			if (pos == 'F') y += len;
			if (pos == 'B') y -= len;
		}
		int x1, y1;
		cin >> x1 >> y1;
		if (x == x1 && y == y1)
			cout << "MEME IS SO LUCKY" << endl;
		else
			cout << "GPS ERROR" << endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 135