码迷,mamicode.com
首页 > 其他好文 > 详细

hdoj:2043

时间:2016-10-27 23:19:13      阅读:258      评论:0      收藏:0      [点我收藏+]

标签:main   std   pac   hdoj   ace   names   iso   bsp   int   

#include <iostream>
#include <string>

using namespace std;

bool judgeSize(string str)
{
    int size = str.size();
    if (size < 8 || size>16)
        return false;
    return true;
}

int isA(string str)
{
    for (auto &c : str)
    {
        if (c >= A && c <= Z)
            return 1;
    }
    return 0;
}
int isa(string str)
{
    for (auto &c : str)
    {
        if (c >= a && c <= z)
            return 1;
    }
    return 0;
}
int is0(string str)
{
    for (auto &c : str)
    {
        if (c >= 0 && c <= 9)
            return 1;
    }
    return 0;
}
int isOther(string str)
{
    for (auto &c : str)
    {
        if (c == ~ || c == ! || c == @ || c == # || c == $ || c == % || c == ^)
            return 1;

    }
    return 0;
}
int main()
{
    int M;
    string str;
    while (cin >> M)
    {
        while (M--)
        {
            cin >> str;
            if (judgeSize(str))
            {
                int judge = isA(str) + isa(str) + is0(str) + isOther(str);
                if (judge >= 3)
                {
                    cout << "YES" << endl;
                }
                else
                {
                    cout << "NO" << endl;
                }
            }
            else
            {
                cout << "NO" << endl;
            }
        }
    }
}

 

hdoj:2043

标签:main   std   pac   hdoj   ace   names   iso   bsp   int   

原文地址:http://www.cnblogs.com/theskulls/p/6005895.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!