华中弱只因


私信TA

用户名:dotcpp0637355

访问量:153

签 名:

等  级
排  名 34884
经  验 405
参赛次数 0
文章发表 6
年  龄 19
在职情况 学生
学  校 华中渴基大学
专  业 船舶与海洋工程

  自我简介:

TA的其他文章


解题思路:

注意事项:

参考代码:

#include
#include
using namespace std;
int main()
{
int q = 0;
cin >> q;
char a[1000];
for(int i=0;i<q;i++)

{
cin >> a;
int l = strlen(a);
int x = 0, y = 0, z = 0, o = 0, sum = 0;
if (l >= 8 && l <= 16)
{
//统计字符类型
for (int i = 0; i < l; i++)
{
if (a[i] >= 'a' && a[i] <= 'z'  ) { x = 1; }
else if (a[i] >= 'A' && a[i] <= 'Z') { o = 1; }
else if (a[i] >= '0' && a[i] <= '9') { y = 1; }
else if (a[i]=='~'||a[i]=='!' || a[i] == '@' || a[i] == '#' || a[i] == '$' || a[i] ==  '%' || a[i] == '^') { z = 1; }
//这里不能直接else,因为逗号字符不行
}
sum = x + y + z+ o;
if (sum == 3) { cout << "YES" << endl; }
else { cout << "NO" << endl; }
}
else { cout << "NO" << endl; }
}
return 0;
}


 

0.0分

0 人评分

  评论区