NOJ2101 7_密码强度(水模拟题)

NOJ2101

#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include<ctype.h>
using namespace std;
char str[100];
int cnt[4];
int main() {
	while (gets(str)){
		int len = strlen(str);
		string s; memset(cnt, 0, sizeof(cnt));
		for (int i = 0; i < len; i++)
		{
			int t_len = s.length(); bool flag = 0;
			if (isupper(str[i]))
				cnt[0]++;
			else if (islower(str[i]))
				cnt[1]++;
			else if (isdigit(str[i]))
				cnt[2]++;
			else
				cnt[3]++;
			for (int j = 0; j < t_len; j++)
			{
				if (str[i] == s[j]){ flag = 1; break; }
			}
			if (!flag)s += str[i];
		}
		int s_len = s.length();
		if (len < 8 || s_len <= 4){ cout << "you are thrown out of server!\n"; continue; }
		int all = 0;
		for (int i = 0; i < 4;i++)
		if (cnt[i])
			all++;
		if (all == 1){ cout << "std::weak is laughing!\n"; continue; }
		if ((all == 2 || all == 3) || (all==4&&len < 13)){ cout << "33luo can crack this!\n"; continue; }
		cout << "NSA is unhappy!\n";
	}
	return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值