按题意模拟就行了,S居然是任意的字符串,给你跪了啊。
代码:
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;
int main()
{
#ifdef LOCAL
freopen("in.txt", "r", stdin);
#endif // LOCAL
int ncase;
cin >> ncase;
//getchar();
while (ncase--)
{
string s;
cin >> s;
if (s == "1" || s == "4" || s == "78")
cout << "+" << endl;
else if (s[s.size() - 1] == '5' && s[s.size() - 2] == '3')
cout << "-" << endl;
else if (s[s.size() - 1] == '4' && s[0] == '9')
cout << "*" << endl;
else if (s[0] == '1' && s[1] == '9' && s[2] == '0')
cout << "?" << endl;
}
return 0;
}