[HDU] [2043] Password

Problem Description

Loading...

Problem Analysis

This was originally supposed to be Problem 1003… but after staring at it for a while I realized I hadn’t actually solved 1003 correctly back then. -.- I’ll post that one once I get it right. Looks like this blogging method of mine does have its benefits~

cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include<stdio.h>
int main() {
	int n,l,a,b,c,d;
	char x;
	scanf("%d\n",&n);
	while(n) {
		for(x=getchar(),a=b=c=d=l=0; x!='\n'; x=getchar(),l++) {
			if(x>='A'&&x<='Z')
				a=1;
			if(x>='a'&&x<='z')
				b=1;
			if(x>='0'&&x<'9')
				c=1;
			if(x=='~'||x=='!'||x=='@'||x=='#'||x=='$'||x=='%'||x=='^')
				d=1;
		}
		if(l>=8&&l<=16&&a+b+c+d>=3)
			printf("YES\n");
		else
			printf("NO\n");
		n--;
	}
	return 0;
}
This post is licensed under CC BY-NC-SA 4.0. If it helped, or if you have anything to say, the comment box below is open.
Page views —
Unique visitors —

Loading...