MTFlowCzq @ 2023-09-01 22:21:00
#include<iostream>
#include<string>
using namespace std;
string s;
int n,pos,a,b,c,d,err;
int main() {
cin>>s;
n=s.size();
for (int i=0;i<=n;i++) {
if (i!=n && s[i]!=',') continue;
int len=i-pos; pos=i+1;
if (len<6 || len>12) continue;
a=b=c=d=err=0;
for (int j=i-len;j<i;j++) {
char c=s[j];
if (c>='A' && c<='Z') a=1;
else if (c>='a' && c<='z') b=1;
else if (c>='0' && c<='9') c=1; // here
else if (c=='!' || c=='@' || c=='#' || c=='$')
d=1;
else { err=1; break; }
}
if (err) continue;
a+=b; a+=c;
if (a>=2 && d) {
for (int j=i-len;j<i;j++)
cout<<s[j];
cout<<endl;
}
}
return 0;
}
此处变量重名,但是代码过了
hack: czq@123456
by MTFlowCzq @ 2023-09-01 22:21:34
(代码注释处有两个不同的 c
)
by xiaoyang111 @ 2023-09-02 14:01:31
啊?这都能过,就很离谱
by wanglexi @ 2023-09-21 21:08:43
@MTFlowCzq 据我所知,重名时C++会选择定义域更小的那个变量
by wanglexi @ 2023-09-21 21:09:16
如果定义域完全相同,那么会CE
by 2345A @ 2024-03-03 11:24:41
hack: czq@123456