HDU ACM 11 2043 密码

来源:互联网 发布:登陆艇升级数据 编辑:程序博客网 时间:2024/05/27 06:54
#include <iostream>#include <string>using namespace std;int main(){int n;string Lu;cin >> n;while (n--){int Yi = 0;int a, b ,c, d;a = b = c = d = 0;cin >> Lu;int x = Lu.length();if (x < 8 || x > 16){cout << "NO\n";continue;}for (int i = 0; i < x; i++){if (!isalpha(Lu[i]) && !isdigit(Lu[i]) && Lu[i] != '~' && Lu[i] != '!' && Lu[i] != '@' && Lu[i] != '#' && Lu[i] != '$' && Lu[i] != '%' && Lu[i] != '^'){cout << "NO\n";Yi++;break;}else if (islower(Lu[i]))a = 1;else if (isupper(Lu[i]))b = 1;else if (isdigit(Lu[i]))c = 1;else if (Lu[i] == '~' || Lu[i] == '!' || Lu[i] == '@' || Lu[i] == '#' || Lu[i] == '$' || Lu[i] == '%' || Lu[i] == '^')d = 1;}if (Yi == 0 && (a + b + c + d) >= 3)cout << "YES\n";elsecout << "NO\n";}return 0;}

0 0
原创粉丝点击