CodeForces 411A Password Check
2016-01-13 11:23
513 查看
A. Password Check
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
You have probably registered on Internet sites many times. And each time you should enter your invented password. Usually the registration form automatically checks the password's crypt resistance. If the user's password isn't complex enough, a message is
displayed. Today your task is to implement such an automatic check.
Web-developers of the company Q assume that a password is complex enough, if it meets all of the following conditions:
the password length is at least 5 characters;
the password contains at least one large English letter;
the password contains at least one small English letter;
the password contains at least one digit.
You are given a password. Please implement the automatic check of its complexity for company Q.
Input
The first line contains a non-empty sequence of characters (at most
100 characters). Each character is either a large English letter, or a small English letter, or a digit, or one of characters: "!", "?", ".",
",", "_".
Output
If the password is complex enough, print message "Correct" (without the quotes), otherwise print message "Too weak" (without the quotes).
Sample test(s)
Input
Output
Input
Output
Input
Output
[/code]
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
You have probably registered on Internet sites many times. And each time you should enter your invented password. Usually the registration form automatically checks the password's crypt resistance. If the user's password isn't complex enough, a message is
displayed. Today your task is to implement such an automatic check.
Web-developers of the company Q assume that a password is complex enough, if it meets all of the following conditions:
the password length is at least 5 characters;
the password contains at least one large English letter;
the password contains at least one small English letter;
the password contains at least one digit.
You are given a password. Please implement the automatic check of its complexity for company Q.
Input
The first line contains a non-empty sequence of characters (at most
100 characters). Each character is either a large English letter, or a small English letter, or a digit, or one of characters: "!", "?", ".",
",", "_".
Output
If the password is complex enough, print message "Correct" (without the quotes), otherwise print message "Too weak" (without the quotes).
Sample test(s)
Input
abacaba
Output
Too weak
Input
X12345
Output
Too weak
Input
CONTEST_is_STARTED!!11
Output
Correct [code]#include<ctype.h> #include<cstring> #include<iostream> #include<algorithm> using namespace std; int main(){ int a,b,c,len,flag,flag1,flag2,flag3; char str[110]; while(cin>>str){ flag=flag2=flag3=0; len=strlen(str); if(len>=5){ for(int i=0;i<len;i++){ if(isdigit(str[i])){ //判断是数字返回非0,不是返回0 flag=1; } else if(islower(str[i])){ //判断是小写字母返回非0,不是返回0 flag2=1; } else if(isupper(str[i])){ //判断是大写字母返回非0,不是返回0 flag3=1; } } if(flag&&flag2&&flag3){ cout<<"Correct"<<endl; } else{ cout<<"Too weak"<<endl; } } else{ cout<<"Too weak"<<endl; } } return 0; }
[/code]
相关文章推荐
- Struts 2.x仍然明显落后于时代。 Struts 2.x这一类老牌Web MVC开发框架仅能用于开发瘦客户端应用,无法用来开发对于交互体验要求更高的应用。
- C#对七牛云的操作
- 11个显著提升 ASP.NET 应用程序性能的技巧——第1部分
- 数据库连接池参数配置
- maven的简单使用
- LeetCode---Pow(x, n)
- 值得推荐的Android应用性能检测工具列表
- 2015年总结
- oracle共享服务器模式
- 在模板类成员函数入参中使用回调函数指针
- C#圆半径圆的周长,使用嵌套类型计算圆面上点到圆心的距离
- javascript 解析ajax返回的xml和json格式的数据
- 2015年度总结
- 【转】动态SQL- case
- 【数组】Game of Life
- typedef与define基本使用
- mapreduce/spark/storm/Tez 框架
- SQLServer: 迁新服务器常见的初始准备工作
- Qt 开发程序后的发布问题
- hdu 1041 Computer Transformation