HDOJ 2043 密码

题目地址:

http://acm.hdu.edu.cn/showproblem.php?pid=2043

水题,直接贴个代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
 // Author: Tanky Woo
// HDOJ 2042
 
#include <iostream>
#include <string.h>
using namespace std;
 
bool IsSafe(char *arr)
{
    int cnt = 0;
    int len = strlen(arr);
    if(len<8 || len>16)
        return 0;
    for(int i=0; i<len; ++i)
        if(arr[i]>='A' && arr[i]<='Z')
        {
            cnt++;
            break;
        }
 
    for(int i=0; i<len; ++i)
        if(arr[i]>='a' && arr[i]<='z')
        {
            cnt++;
            break;
        }
 
    for(int i=0; i<len; ++i)
        if(arr[i]>='0' && arr[i]<='9')
        {
            cnt++;
            break;
        }
 
    for(int i=0; i<len; ++i)
        if(arr[i]=='~' || arr[i]=='!' || arr[i]=='@'
            || arr[i]=='#' || arr[i]=='$' || arr[i]=='%' || arr[i]=='^')
        {
            cnt++;
            break;
        }
    if(cnt >= 3)
        return 1;
    else
        return 0;
}
 
int main()
{
    int nCases;
    char cipher[60];
    scanf("%d", &nCases);
    while(nCases--)
    {
        getchar();
        scanf("%s", cipher);
        if(IsSafe(cipher))
            printf("YES\n");
        else
            printf("NO\n");
    }
    return 0;
}

发布者

Tanky Woo

Tanky Woo,[个人主页:https://tankywoo.com] / [新博客:https://blog.tankywoo.com]

《HDOJ 2043 密码》有56个想法

  1. The closing paragraph tells all of it in my opinion. I need to say that I agree with it, and essentially the most wonderful factor about it is that you left it open ended…this shows that you’re ready to draw in new and different opinions and that you’re ultimately very interested to see folks getting concerned within the subject. So, any different opinions?

发表评论

电子邮件地址不会被公开。 必填项已用*标注