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

来源:互联网 发布:怎么添加usb001端口 编辑:程序博客网 时间:2024/06/05 05:00

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]++;elsecnt[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;}


0 0
原创粉丝点击