码迷,mamicode.com
首页 > 其他好文 > 详细

HDU2043 密码

时间:2015-11-05 06:08:08      阅读:114      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!