首页 > 其他 > 详细

HDU2043 密码

时间:2015-11-05 06:06:55      阅读:116      评论:0      收藏:0      [点我收藏+]

解题思路:10分钟AC,不解释,so easy!

技术分享
 1 #include<cstdio>
 2 #include<cstring>
 3 #include<algorithm>
 4 using namespace std;
 5 const int maxn = 55;
 6 char str[maxn];
 7 int n;
 8 int main()
 9 {
10     scanf("%d", &n);
11     while(n--)
12     {
13         scanf("%s", str);
14         int len = strlen(str);
15         int cnt = 0;
16         int cnt1, cnt2, cnt3, cnt4;
17         cnt1 = cnt2 = cnt3 = cnt4 = 0;
18         for(int i = 0; i < len; i++)
19         {
20             if(str[i] >= a && str[i] <= z) cnt1 = 1;
21             else if(str[i] >= A && str[i] <= Z) cnt2 = 1;
22             else if(str[i] >= 0 && str[i] <= 9) cnt3 = 1;
23             else cnt4 = 1;
24         }
25         cnt = cnt1 + cnt2 + cnt3 + cnt4;
26         if(cnt >= 3 && len >=8 && len <= 16) printf("YES\n");
27         else printf("NO\n");
28     }
29     return 0;
30 }
View Code

 

HDU2043 密码

原文:http://www.cnblogs.com/loveprincess/p/4937914.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!