华为oj 密码验证合格程序
来源:互联网 发布:淘宝厨房用品 编辑:程序博客网 时间:2024/06/04 08:39
#include<iostream>#include<string>#include<string.h>#include<vector>using namespace std;bool typeCheck(string s){const char *k = s.c_str();int count[4];memset(count,0,4*sizeof(int)); while((*k)!='\0'){ if(isdigit(*k)) count[0] = 1; else if(isupper(*k)) count[1] = 1; else if (islower(*k)) count[2] = 1; else count[3] = 1; ++k;} int last = count[0]+count[1]+count[2]+count[3];if(last>=3) return true;else return false;}bool sameSubstr(string s){for(int i=0;i<s.size()-1;i++) for(int j = i+1;j<s.size();j++) { int tempi = i; int tempj = j; int count = 0; while(s[tempi] == s[tempj]&&tempi<s.size()&&tempj<s.size()) { ++count; if(count>2) return true; ++tempi; ++tempj; } } return false;}int main(){string s;while(getline(cin,s)){//cout<<s<<endl;if(s.size()<=8) cout<<"NG"<<endl;else{ if(typeCheck(s)) { if(sameSubstr(s)) cout<<"NG"<<endl; else cout<<"OK"<<endl; } else cout<<"NG"<<endl; } } return 0;}
0 0
- 华为oj之密码验证合格程序
- 【华为oj】密码验证合格程序
- 华为OJ(密码验证合格程序)
- 华为oj 密码验证合格程序
- 华为OJ 密码验证合格程序
- 密码验证合格程序(华为oj)
- 【华为OJ】【017-密码验证合格程序】
- 【华为 OJ】密码验证合格程序
- 华为oj 密码验证合格程序
- 华为OJ 密码验证合格程序
- 华为oj中级 密码验证合格程序
- 华为OJ密码验证合格程序
- 华为OJ-----密码验证合格程序
- 华为OJ-密码验证合格程序-牛客网
- 华为OJ中级题-密码验证合格程序
- 华为OJ——密码验证合格程序
- 华为OJ——密码验证合格程序
- OJ-----密码验证合格程序
- c/c++宏定义的基本用法
- Best Time to Buy and Sell Stock II
- java -jar 与nohup的区别
- Mybatis+0+null,小问题引发的血案
- SVN常用命令之merge(合并)
- 华为oj 密码验证合格程序
- 图像直方图相关总结
- GroupManagementController.java
- 虚幻4学习——TSubclassof<>的用法
- 桥接模式和NAT模式区别
- MySQL并发复制系列一:binlog组提交
- 软件调试技巧
- SSM框架——详细整合教程(Spring+SpringMVC+MyBatis)
- 记录一次 disassembling crack经历