解题思路:
注意四个中的三个
我用了暴力判断加sort排序巧妙解决四个中三个的问题
注意事项:
参考代码:
#include <bits/stdc++.h> #include <iostream> using namespace std; int main() { char str[100]; int a[4]; int n; cin>>n; while(n--) { memset(a,0,sizeof(a)); int k=0,b=0,c=0,d=0; scanf("%s",str); for(int i = 0;i < strlen(str);i++) { if(str[i]>='A'&&str[i]<='Z') a[0]++; else if(str[i]>='a'&&str[i]<='z') a[1]++; else if(str[i]=='~'||str[i]=='!'||str[i]=='@'||str[i]=='#'||str[i]=='$'||str[i]=='%'||str[i]=='^') a[2]++; else if(str[i]>='0'&&str[i]<='9') a[3]++; } sort(a,a+4); //cout<<a[0]<<a[1]<<a[2]<<a[3]<<endl; if(a[1]>=1) cout<<"YES"<<endl; else cout<<"NO"<<endl; } return 0; }
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题10.7 (C语言代码)浏览:511 |
C二级辅导-进制转换 (C语言代码)浏览:615 |
WU-整数平均值 (C++代码)浏览:1240 |
DNA (C语言描述,数据结构)浏览:851 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:262 |
罗列完美数 (C语言代码)浏览:491 |
演讲大赛评分 (C语言代码)浏览:1629 |
C语言程序设计教程(第三版)课后习题9.6 (C语言代码)浏览:579 |
2006年春浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:661 |
C语言程序设计教程(第三版)课后习题10.7 (用指针求解)浏览:1462 |