xuzhengfei666 @ 2024-10-24 21:45:18
#include<bits/stdc++.h>
using namespace std;
string s,t="";
int az=0,AZ=0,_9=0,zf=0;
bool pdzf=true;
int a,b,c,d;
int main()
{
cin>>s;
for(int i=0;i<s.length();i++)
{
if(s[i]!=',')
{
t+=s[i];
}
else
{
for(int j=0;j<t.length();j++)
{
if(t[j]>='a'&&t[j]<='z')
{
az=1;
a++;
}
else if(t[j]>='A'&&t[j]<='Z')
{
AZ=1;
b++;
}
else if(t[j]=='!'||t[j]=='@'||t[j]=='#'||t[j]=='$')
{
zf=1;
c++;
}
else if(t[j]>='0'&&t[j]<='9')
{
_9=1;
d++;
}
else
{
pdzf=false;
break;
}
}
if(pdzf=true&&az+AZ+_9>=2&&zf==1&&a+b+c+d>=6&&a+b+c+d<=12)
{
cout<<t<<endl;
}
t="";
}
}
return 0;
}
by zc1234567890080 @ 2024-10-24 21:55:14
pdzf==true而非pdzf=true
by zc1234567890080 @ 2024-10-24 22:00:04
还有a b c d未清空
by xuzhengfei666 @ 2024-10-25 21:23:19
#include<bits/stdc++.h>
using namespace std;
string s,t="";
int az=0,AZ=0,_9=0,zf=0;
bool pdzf=true;
int a,b,c,d;
int main()
{
cin>>s;
for(int i=0;i<s.length();i++)
{
if(s[i]!=',')
{
t+=s[i];
}
else
{
for(int j=0;j<t.length();j++)
{
if(t[j]>='a'&&t[j]<='z')
{
az=1;
a++;
}
else if(t[j]>='A'&&t[j]<='Z')
{
AZ=1;
b++;
}
else if(t[j]=='!'||t[j]=='@'||t[j]=='#'||t[j]=='$')
{
zf=1;
c++;
}
else if(t[j]>='0'&&t[j]<='9')
{
_9=1;
d++;
}
else
{
pdzf=false;
break;
}
}
if(pdzf==true&&az+AZ+_9>=2&&zf==1&&a+b+c+d>=6&&a+b+c+d<=12)
{
cout<<t<<endl;
}
t="";
a=0,b=0,c=0,d=0;
}
}
return 0;
}
这样还是不对呀 @zc1234567890080