tiantianyang @ 2024-11-17 14:50:44
代码如下:
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
string a;
cin>>a;
a=a+",";
string qg[1000];
int tmp=0;
for(int i=0;i<a.size();i++){
if(a[i]==','){
tmp+=1;
}else{
qg[tmp]=qg[tmp]+a[i];
}
}
int tx=0,td=0,tz=0,ts=0;
for(int i=0;i<tmp;i++){
tx=0;td=0;tz=0;ts=0;
if(qg[i].size()<6||qg[i].size()>12) i++;
else {
for(int j=0;j<qg[i].size();j++)
if(qg[i][j]<='z'&&qg[i][j]>='a') tx+=1;
else if(qg[i][j]<='Z'&&qg[i][j]>='A') td+=1;
else if(qg[i][j]<='9'&&qg[i][j]>='0') ts+=1;
else if(qg[i][j]=='!'||qg[i][j]=='@'||qg[i][j]=='#'||qg[i][j]=='$') tz+=1;
else i++;
if(((tx&&td)||(tx&&ts)||(ts&&td))&&tz) cout<<qg[i]<<endl;
}
}
return 0;
}
by tiantianyang @ 2024-11-17 14:51:52
救救我,求求了!
by _L_Z_Y_ @ 2024-11-17 15:47:35
ME TOO!我也是
by HuangSiHan3116 @ 2024-11-23 22:03:19
#include<bits/stdc++.h>
#include<string>
using namespace std;
string s,y;//y验证
int main(){
getline(cin,s);
s+=',';//最后无","要自已加
for(int i=0;i<s.size();i++){
if(s[i]==','){//","不加
int a=0,b=0,c=0,d=0,flag=0;
for(int j=0;j<y.size();j++){
if(y[j]>='0'&&y[j]<='9'){
a=1;//数字
}else if(y[j]>='a'&&y[j]<='z'){
b=1;//小写
}else if(y[j]=='!'||y[j]=='@'||y[j]=='#'||y[j]=='$'){
c=1;//符号
}else if(y[j]>='A'&&y[j]<='Z'){
d=1;//大写
}else{
flag=1;
break;
}
}
if(flag==0&&(a+b==2||b+d==2||a+d==2)&&c==1&&y.size()<=12&&y.size()>=6){
//重点:注意题目描述,至少其中2种
cout<<y<<endl;
}
y="";
}else{//不是","就加
y.push_back(s[i]);
}
}
return 0;
}//求关
@LZY109469@tiantianyang
by HuangSiHan3116 @ 2024-11-23 22:05:34
@tiantianyang
你这错太多改不过来
by HuangSiHan3116 @ 2024-11-23 22:10:39
@tiantianyang
if(qg[i][j]<='z'&&qg[i][j]>='a') tx+=1;
else if(qg[i][j]<='Z'&&qg[i][j]>='A') td+=1;
else if(qg[i][j]<='9'&&qg[i][j]>='0') ts+=1;
else if(qg[i][j]=='!'||qg[i][j]=='@'||qg[i][j]=='#'||qg[i][j]=='$') tz+=1;
else i++;
if(qg[i].size()<6||qg[i].size()>12) i++;
//别i++,要用coutinue;
by HuangSiHan3116 @ 2024-11-23 22:12:26
@HuangSiHan3116
by tiantianyang @ 2024-11-25 22:06:02
@HuangSiHan3116 感谢
by caoyichen1 @ 2024-12-01 16:50:01
#include<bits/stdc++.h>
using namespace std;
bool judge_whether_the_password_is_compliant(string m,int t)
{
if (t<6||t>12)
{
return 0;
}
bool does_the_capital_letter_match=0,do_lowercase_letters_match=0,does_the_figure_match=0,does_the_special_character_match=0;
for (int i=0;m[i]!='\0';i++)
{
if (m[i]>='A'&&m[i]<='Z')
{
does_the_capital_letter_match=1;
}
else if(m[i]>='a'&&m[i]<='z')
{
do_lowercase_letters_match=1;
}
else if(m[i]>='0'&&m[i]<='9')
{
does_the_figure_match=1;
}
else if(m[i]=='!'||m[i]=='@'||m[i]=='#'||m[i]=='$')
{
does_the_special_character_match=1;
}
else
{
return 0;
}
}
if (!does_the_special_character_match||does_the_capital_letter_match+do_lowercase_letters_match+does_the_figure_match<2)
{
return 0;
}
return 1;
}
int main()
{
char n[102],m[102];
int t=0;
cin>>n;
for (int i=0;n[i]!='\0';i++)
{
if (n[i]!=',')
{
m[t]=n[i];
t++;
}
else
{
m[t]='\0';
if (judge_whether_the_password_is_compliant(m,t))
{
cout<<m<<endl;
}
t=0;
}
}
if (t>0)
{
m[t]='\0';
if (judge_whether_the_password_is_compliant(m,t))
{
cout<<m;
}
}
return 0;
}
by xiezt123456 @ 2024-12-03 17:57:26
@caoyichen1这变量名看得我头皮发麻
by caoyichen1 @ 2024-12-15 20:14:06
@[xiezt123456(luogu://user/1498619) 谁叫我英文好呢