virtual hust 2013.6.23 数学杂题基础题目 D

题目:Secret Research

思路:水题。。也是直接判断一下

#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
using namespace std;
bool positive(string s)
{
    if(s=="1"||s=="4"||s=="78")
        return true;
    return false;
}
bool negative(string s)
{
    int l=s.size();
    if(s[l-1]=='5'&&s[l-2]=='3')
        return true;
    return false;

}
bool failed(string s)
{
    if(s[s.size()-1]=='4'&&s[0]=='9')
        return true;
    return false;
}
bool not_complete(string s)
{
    if(s[0]=='1'&&s[1]=='9'&&s[2]=='0')
        return true;
    return false;
}
void solve(string s)
{
    if(positive(s))
        printf("+
");
    else if(negative(s))
        printf("-
");
    else if(failed(s))
        printf("*
");
    else
        printf("?
");
}
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        string s;
        cin>>s;
        solve(s);
    }
    return 0;
}
View Code
原文地址:https://www.cnblogs.com/overflow/p/3150625.html