hichens


私信TA

用户名:he1559576917

访问量:6883

签 名:

he1559576917

等  级
排  名 1960
经  验 2436
参赛次数 0
文章发表 14
年  龄 0
在职情况 学生
学  校 CQUPT
专  业

  自我简介:

代码千万条,注释第一条。 注释不清楚,亲人两行泪。

解题思路:

注意事项:

参考代码:

#include<stdio.h>

#include<string.h>

#include<ctype.h>

int main(){

    char a[100];

    int n,t,t1,t2,t3,t4,i;//t控制条件一,t1,t2,t3,t4分别控制条件二的四个测试;满足则为1,否则0;

    scanf("%d",&n);

    getchar();


    while(n--){

        t = 0; t1 = 0; t2 = 0; t3 = 0; t4 = 0; i = 0;

        gets(a);

        if(strlen(a)>=8&&strlen(a)<=16) t = 1;

        while(a[i]){

            if(islower(a[i])) t1 = 1;

            if(isupper(a[i])) t2 = 1;

            if(a[i]>='0'&&a[i]<='9') t3 = 1;

            if(a[i] == '~'||a[i] == '!'||a[i] == '@'||a[i] == '#'||

               a[i] == '$'||a[i] == '%'||a[i] == '^') t4 = 1;

            ++i;

        }

        if(t1+t2+t3+t4>=3&&t) printf("YES\n");

        else printf("NO\n");

    }

    return 0;

}


 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区