Thursday, June 11, 2015

UVa 621 - Secret Research

// UVa 621 - Secret Research
#include <iostream>
#include <string>
using namespace std;

int main() {
	int n;
	cin >> n;
	string s;
	getline(cin, s);
	for (; n; n--) {
		getline(cin, s);
		if (s == "1" || s == "4" || s == "78")
			cout << "+" << endl;
		else if (s.length() >= 2 && s.substr(s.length() - 2) == "35")
			cout << "-" << endl;
		else if (s.length() >= 2 && s[0] == '9' && s[s.length() - 1] == '4')
			cout << "*" << endl;
		else if (s.length() >= 3 && s.substr(0, 3) == "190")
			cout << "?" << endl;
		else
			cout << "+" << endl;
	}
	return 0;
}

No comments:

Post a Comment