当前位置:编程学习 > C/C++ >>

杭电ACM2043密码的问题已经AC

[cpp]
#include <iostream>  
#include <stdio.h>  
#include <string.h>  
using namespace std; 
int main() 

    char a[50]; 
    int m,k1,k2,k3,k4; 
    unsigned i; 
    cin>>m; 
    getchar(); 
    while(m--) 
    { 
        k1=k2=k3=k4=0; 
        cin.getline(a,50); 
        if(strlen(a)<8||strlen(a)>16) 
        { 
            cout<<"NO"<<endl; 
        } 
        else 
        { 
            for(i=0;i<strlen(a);i++) 
            { 
                if(a[i]>='0'&&a[i]<='9') 
                    k1=1; 
                if(a[i]>='a'&&a[i]<='z') 
                    k2=1; 
                if(a[i]>='A'&&a[i]<='Z') 
                    k3=1; 
                if(a[i]=='~'||a[i]=='!'||a[i]=='@'||a[i]=='#'||a[i]=='$'||a[i]=='%'||a[i]=='^') 
                    k4=1; 
            } 
            if(k1+k2+k3+k4>=3) 
                cout<<"YES"<<endl; 
            else 
                cout<<"NO"<<endl; 
 
        } 
    } 
    return 0; 

补充:软件开发 , C++ ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,