???????????????????

B3843 [GESP202306 三级] 密码合规

wwwee @ 2024-05-24 13:01:30

#include<bits/stdc++.h>
using namespace std;
long long x,n,q=0,i,j,t,k,w=0,y,e=0,p,r=0,u;
string a,b;                 
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>a;
    n=a.size();
    for(i=0;i<n;i++)
    {
        q=w=e=r=t=u=0;
        y=0;
        while(a[i]!=','&&i<n)
        {
            if(a[i]>='a'&&a[i]<='z')q=1;
            else if(a[i]>='A'&&a[i]<='Z')w=1;
            else if(a[i]>='1'&&a[i]<='9')e=1;
            else if(a[i]=='!'||a[i]=='@'||a[i]=='#'||a[i]=='$')r++;
            else u++;
            t++;
            b[y++]=a[i];
            i++;
        }
        if(t>=6&&t<=12&&r&&!u)
        {
            if(q+w+e>=2)
            {
                for(j=0;j<y;j++)cout<<b[j];
                cout<<endl;
            }   

        }
    }

    return 0;
}

by H_MC @ 2024-05-25 07:09:38

else if(a[i]>='0' && a[i]<='9')啊
而且y和t的作用重复了
把t去掉,再把if那里改成y>=5 && y<=13 && r && !u就过了


by wwwee @ 2024-05-26 10:05:50

@huangmingcheng2023 thank you!!


|