HDU 2043 密码
http://acm.hdu.edu.cn/showproblem.php?pid=2043
首先,我们就要设置一个安全的密码。那什么样的密码才叫安全的呢?一般来说一个比较安全的密码至少应该满足下面两个条件:
(1).密码长度大于等于8,且不要超过16。
(2).密码中的字符应该来自下面“字符类别”中四组中的至少三组。
这四个字符类别分别为:
1.大写字母:A,B,C...Z;
2.小写字母:a,b,c...z;
3.数字:0,1,2...9;
4.特殊符号:~,!,@,#,$,%,^;
给你一个密码,你的任务就是判断它是不是一个安全的密码。
代码:
#include <bits/stdc++.h> using namespace std; char s[111];
int len;
int A()
{
for(int i=0; i<len; i++)
{
if(s[i]>='a'&&s[i]<='z')
return 2;
else
continue;
}
return 1;
}
int B()
{
for(int i=0; i<len; i++)
{
if(s[i]>='A'&&s[i]<='Z')
return 2;
else
continue;
}
return 1;
}
int C()
{
for(int i=0; i<len; i++)
{
if(s[i]=='~'||s[i]=='!'||s[i]=='@'||s[i]=='#'||s[i]=='$'||s[i]=='%'||s[i]=='^')
return 2;
else
continue;
}
return 1;
}
int D()
{
for(int i=0; i<len; i++)
{
if(s[i]>='0'&&s[i]<='9')
return 2;
else
continue;
}
return 1;
}
int main()
{
int m;
cin>>m;
for(int i=1; i<=m; i++)
{
int sum=1;
scanf("%s",s);
len = strlen(s);
sum=A()*B()*C()*D();
//cout<<A()<<B()<<C()<<D()<<sum<<endl;
if(sum>=8&&len>=8&&len<16)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}
HDU 2043 密码的更多相关文章
- HDU - 2043密码 水题
密码 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submissi ...
- hdu 2043
Ps:自己写了以后又去看了下苏哥的....改进版的....学到东西,直接套用了. 代码: #include "stdio.h"#include "string.h&quo ...
- 杭电-------2043密码(C语言写)
#include<stdio.h> #include<string.h> ]; ] = { '~','!','@','#','$','%','^' }; ] = { }; in ...
- 致初学者(三): HDU 2033~ 2043题解
下面继续给出HDU 2033~2043的AC程序,供大家参考.2033~2043这10道题就被归结为“ACM程序设计期末考试(2006/06/07) ”和“2005实验班短学期考试 ”. HDU 20 ...
- 杭电oj2028、2034、2035、2041、2043-2046
2028 Lowest Common Multiple Plus #include<stdio.h> int gcd(int a,int b){ int temp,temp1; if(a ...
- HDU 5968 异或密码
p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-s ...
- HDU 5968 异或密码 【模拟】 2016年中国大学生程序设计竞赛(合肥)
异或密码 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Problem Des ...
- HDU 1226 超级密码(数学 bfs)
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1226 超级密码 Time Limit: 20000/10000 MS (Java/Others) ...
- hdu.1226.超级密码(bfs)
超级密码 Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Sub ...
随机推荐
- Linux基础第四课——文件操作
文件的创建 touch sudo touch 文件1 文件2 文件3 #支持批量创建文件 sudo rm -f 文件1 文件2 文件3 #支持批量创建 也支持批量删除 echo '谁动谁输,对不起我输 ...
- hashCode相关性能优化
学习下hashMap中用到的关于hashCode性能优化技巧.作为笔记.为之后并发深入作基础. 1.关于提高性能的hash算法 在被模的位数为2的n次方时,用位与取代效率低下的模运算.位与效率相比模运 ...
- Hunter -- 批量文件管理工具
一个简单工具, 用来进行批量文件的重命名, 更改后缀, 搜索特定后缀, 等 下载地址:http://download.csdn.net/download/kuangsun/7545179
- 2018-2019-2 《网络对抗技术》Exp0 Kali安装 Week1 20165318
2018-2019-2 <网络对抗技术>Exp0 Kali安装 Week1 20165318 下载地址 Kali官网,选择Kali Linux 64 bit VMware 安装步骤 以下步 ...
- FFMPEG详细参数
这几天做视频相关的东西,找到了这款比较牛掰的工具FFmpeg Howto Table of Contents * Generic Syntax * Main Options * Encoding : ...
- WebService 的CXF框架 WS独立服务之HelloWorld
WebService:不同系统不同语言的数据交互, CXF主要分为两种服务方式: 1 )JAX-WS:传输数据, xml格式,基于SOAP协议(规范:规定了xml传递数据的编码规范) ; 2 )JAX ...
- (转)linux下查看已安装的软件与卸载
因为linux安装软件的方式比较多,所以没有一个通用的办法能查到某些软件是否安装了.总结起来就是这样几类: 1.rpm包安装的,可以用rpm -qa看到,如果要查找某软件包是否安装,用 rpm -qa ...
- zookeeper入门之Curator的使用之几种监听器的使用
package com.git.zookeeper.passwordmanager.listener; import java.util.ArrayList; import java.util.Lis ...
- centos 7 安装python3.5.1
系统: [root@localhost ~]# cat /etc/centos-release CentOS Linux release 7.2.1511 (Core) 内核: [root@local ...
- EasyUI panel
1.脚本生成panel 2.panel属性 3.panel事件 4.panel方法 一 脚本生成panel <div id="tt"></div> < ...