大佬们救助

B3843 [GESP202306 三级] 密码合规

xww4444 @ 2024-12-14 15:11:31

#include<bits/stdc++.h>
using namespace std;
string s1,s2;
bool a,b,t=1;
int n1,n2,n3;
int main(){
    cin>>s1;
    for(int i=0;i<s1.size();i++)if(s1[i]==',')n1++;
    for(int j=1;j<=n1;j++){
        for(int i=0;s1[i]==',';i++)s2[i]=s1[i],n2++;
        if(n2>12||n2<6)t=0,b=1;
        if(b==0){
            for(int i=0;s1[i]==',';i++){
                if(s2[i]>='a'&&s2[i]<='z')n3++;
                if(s2[i]>='A'&&s2[i]<='Z')n3++;
                if(s2[i]>='0'&&s2[i]<='9')n3++;
                if(s2[i]=='!'||s2[i]=='@'||s2[i]=='#'||s2[i]=='$')a=1;
            }
        }
        if(n3<=1&&a==0)t=0;
        if(t==1)cout<<s2<<"\n";
        s2='\n';
        t=1;
        n2=0;
        n3=0;
        a=0;
    }
    return 0;
}

by fairfriendZ @ 2024-12-14 15:34:31

@xww4444 不是你这里在干什么

for(int i=0;s1[i]==',';i++)

|