virtual hust 2013.6.23 数学杂题基础题目 D - Secret Research

本文详细解读了名为'SecretResearch'的代码段,包括其核心思路、判断逻辑及功能实现。通过分析代码,我们可以了解如何使用C++进行特定问题的解决,包括正负数判断、失败状态识别及完整性检查等。此代码片段展示了C++编程中的实用技巧和逻辑思考过程。

题目: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("+\n");
    else if(negative(s))
        printf("-\n");
    else if(failed(s))
        printf("*\n");
    else
        printf("?\n");
}
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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值