解题思路:
注意四个中的三个
我用了暴力判断加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 人评分
2004年秋浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:595 |
printf基础练习2 (C语言代码)浏览:768 |
上车人数 (C语言代码)浏览:1180 |
C语言程序设计教程(第三版)课后习题10.2 (C语言代码)浏览:1020 |
简单的a+b (C语言代码)浏览:494 |
C语言程序设计教程(第三版)课后习题9.1 (Java代码)浏览:471 |
【亲和数】 (C语言代码)浏览:495 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:575 |
C语言程序设计教程(第三版)课后习题10.7 (C语言代码)浏览:545 |
WU-格式化数据输出 (C++代码)浏览:1212 |