#include <iostream>
2026-09-20 19:41:07
发布于:广东
0阅读
0回复
0点赞
#include <iostream>
#include <string>
using namespace std;
int main() {
int T;
cin >> T; // 读取密码组数
while (T--) {
string pwd;
cin >> pwd; // 读取当前密码
// 条件1:长度检查
if (pwd.size() < 8) {
cout << "N" << endl;
continue; // 长度不足,直接跳过
}
bool hasUpper = false; // 是否有大写字母
bool hasDigit = false; // 是否有数字
// 遍历每个字符
for (int i = 0; i < pwd.size(); i++) {
if (pwd[i] >= 'A' && pwd[i] <= 'Z') {
hasUpper = true; // 找到大写字母
}
if (pwd[i] >= '0' && pwd[i] <= '9') {
hasDigit = true; // 找到数字
}
}
// 三个条件都满足才输出Y
if (hasUpper && hasDigit) {
cout << "Y" << endl;
} else {
cout << "N" << endl;
}
}
return 0;
}
这里空空如也








有帮助,赞一个