题意:根据题目判断,然后输出对应字符。。
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
int n;
scanf("%d",&n);
while(n--)
{
char str[1000];
scanf("%s",str);
int len=strlen(str);
if(len==1||len==2)
{
if(len==1&&(str[0]=='1'||str[0]=='4')){puts("+");continue;}
else if(len==2&&str[0]=='7'&&str[1]=='8'){puts("+");continue;}
}
else
{
if(str[len-2]=='3'&&str[len-1]=='5'){puts("-");continue;}
if(str[0]=='9'&&str[len-1]=='4'){puts("*");continue;}
if(str[0]=='1'&&str[1]=='9'&&str[2]=='0'){puts("?");continue;}
}
}
return 0;
}