杭电2043 http://acm.hdu.edu.cn/showproblem.php?pid=2043
题目大意:
判断字符大小和字符中出现的类型即可。
AC代码:
#include <iostream>
#include <cstring>
using namespace std;
char s[200];
int a,b,c,d;
int n;
int main() {
while(cin>>n) {
for (int i = 0; i < n; i++) {
memset(s,0,sizeof(s));
a=0,b=0,c=0,d=0;
cin >> s;
int len = strlen(s);
if (len < 8 || len > 16) {
cout << "NO" << endl;
} else {
for (int i = 0; i < len; i++) {
if (s[i] >= 'A' && s[i] <= 'Z') a = 1;
if (s[i] >= 'a' && s[i] <= 'z') b = 1;
if (s[i] >= '0' && s[i] <= '9') c = 1;
if (s[i] == '~' || s[i] == '!' || s[i] == '@' || s[i] == '#' || s[i] == '$' || s[i] == '%' ||
s[i] == '^')
d = 1;
}
if (a + b + c + d >= 3) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
}
}
}
return 0;
}