Coder-Strike 2014 - Qualification Round A. Password Check(简单字符串)
2014-04-15 16:24
483 查看
1、http://codeforces.com/contest/411/problem/A
2、题目:
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
3、AC代码:
2、题目:
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
abacaba
Output
Too weak
Input
X12345
Output
Too weak
Input
CONTEST_is_STARTED!!11
Output
Correct
3、AC代码:
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
char str[105];
int main()
{
while(scanf("%s",str)!=EOF)
{
int l=strlen(str);
if(l<5)
printf("Too weak\n");
else
{
int flag1=0,flag2=0,flag3=0,flag=0;
for(int i=0; i<l; i++)
{
if(str[i]>='a' && str[i]<='z')
{
flag1=1;
}
else if(str[i]>='A' && str[i]<='Z')
{
flag2=1;
}
else if(str[i]>='1' && str[i]<='9')
{
flag3=1;
}
else
{
continue;
}
if(flag1==1 && flag2==1 && flag3==1)
{
flag=1;
break;
}
}
if(flag==1)
printf("Correct\n");
else
printf("Too weak\n");
}
}
return 0;
}
/*
a
abacabaX12345CONTEST_is_STARTED!!11*/
相关文章推荐
- Coder-Strike 2014 - Qualification Round——A. Password Check
- Coder-Strike 2014 - Qualification Round C. Kicker(推理题)
- Coder-Strike 2014 - Round 1 C. Pattern
- Coder-Strike 2014 - Round 1 D. Giving Awards
- Coder-Strike 2014 - Round 2
- Coder-Strike 2014 - Round 2
- Coder-Strike 2014 - Round 1__E-mail Addresses
- Coder-Strike 2014 - Round 1 E. E-mail Addresses
- Coder-Strike 2014 - Round 1
- Coder-Strike 2014 - Round 2 B. Spyke Chatting
- Coder-Strike 2014 - Round 1 D. Giving Awards
- Coder-Strike 2014 - Round 1 B. Network Configuration
- codeforces Coder-Strike 2014 Round 1 C题解题报告
- Coder-Strike 2014 - Round 2 A. Data Recovery
- Coder-Strike 2014 - Round 2 C. Jeopardy!
- 模拟 Coder-Strike 2014 - Round 1 A. Poster
- codeforces Coder-Strike 2014 Round 1 B题解题报告
- 【索引】Coder-Strike 2014 - Round 1
- [Codeforces]Coder-Strike 2014 - Round 1
- codeforces Coder-Strike 2014 Round 1 A题解题报告