题目比较简单,只有四种情况,有歧义题目说按照从上到下的规则匹配,于是就依次比较就AC了。。。
/* * uva621.cpp * * Created on: 2013-4-16 * Author: jd */#include#include int main() {// setbuf(stdout,NULL); int n; char str[1000]; scanf("%d", &n); while (n--) { scanf("%s", str); int len=strlen(str); if (strcmp(str, "1") == 0 || strcmp(str, "4") == 0 || strcmp(str, "78") == 0) printf("+\n"); else if(str[len-2]=='3'&&str[len-1]=='5') printf("-\n"); else if(str[0]=='9'&&str[len-1]=='4') printf("*\n"); else if(str[0]=='1'&&str[1]=='9'&&str[2]=='0') printf("?\n"); } return 0;}