Post
by dwyak » Fri Sep 06, 2002 10:18 am
The problem is simple, but I cannot get AC.
I've tested. There's no illegal case in input.
Are there any tricks?
And there's my program.
[cpp]#include <fstream.h>
#include <string.h>
//ifstream fin("621.txt");
#define fin cin
#define endl '\n'
char str[1000000];
main() {
int cases, pcase;
fin >> cases;
for (pcase = 0; pcase < cases; pcase++) {
fin >> str;
if (strcmp(str, "1") == 0 || strcmp(str, "4") == 0 || strcmp(str, "78") == 0) {
cout << "+" << endl;
continue;
}
int l = strlen(str);
if (l >= 2 && str[l - 1] == '5' && str[l - 2] == '3') {
cout << "-" << endl;
continue;
}
if (str[0] == '9' && str[l - 1] == '4') {
cout << "*" << endl;
continue;
}
if (l >= 3 && str[0] == '1' && str[1] == '9' && str[2] == '0') {
cout << "?" << endl;
continue;
}
cout << endl;
}
return 0;
}[/cpp]
Wenyuan Dai, Shanghai Jiaotong University.