题目大意: 求给出的数字是哪一种编码
解题思路:用数组存储,然后在进行比较
#include<cstdio>
#include<cstring>
int main() {
char str[10000];
int test;
scanf("%d\n", &test);
for(int i = 0; i < test; i++) {
gets(str);
int len = strlen(str);
if(strcmp(str,"1") == 0 || strcmp(str,"4") == 0 || strcmp(str,"78") == 0 ) {
printf("+\n");
continue;
}
if(len >=2 && str[len - 1] == '5' && str[len - 2] == '3') {
printf("-\n");
continue;
}
if(len >= 2 && str[0] == '9' && str[len -1] == '4') {
printf("*\n");
continue;
}
if(len >= 3 && str[0] == '1' && str[1] == '9' && str[2] == '0')
printf("?\n");
memset(str,'\0',sizeof(str));
}
return 0;
}