TLE求调
查看原帖
TLE求调
1393513
C_Spamton楼主2025/1/23 20:54
#include <iostream>
using namespace std;
//
string str[20];
int main()
{
	int stri=0;
	int strlen = 0;/*记录密码长度,以验证密码合规性*/
	int kind = 0;
	int skind = 0;
	char c;
	
	while (true)
	{
		cin.get(c);
		if (c == 10)/*是否为换行*/ {
			break;
		}else if (c != ',')/*是否不是逗号*/ {
			if /*字符是否合规*/ ((c >= '0' and c <= '9') or (c >= 'A' and c <= 'Z')
							or (c >='a' and c<='z')
							or (c=='!') or (c=='@') or (c=='#') or (c=='$')){
				if((c >= '0' and c <= '9') or (c >= 'A' and c <= 'Z') or (c >='a' and c<='z'))
					kind++;
				else skind++;
				strlen++;//增加密码长度
				str[stri]+=c;
			}
			else/*不合规*/ {
				bool isEnd = false;
				do {/*丢弃这段密码的下半部分*/
					cin.get(c);
					if (c == 10) {
						isEnd = true;
						break;
					}
				} while (c!=',');
				if (isEnd)
					return 0;
			}
			
		}else /*逗号*/{
			if ((strlen >= 6 and strlen <= 12) and (kind >= 2 and skind >=1))/*检验密码长度、全面性是否合规*/ {
				cout << str[stri] << endl;
			}
			strlen = 0;
			kind = 0;
			skind = 0;
			stri++;
		}
	}
}
2025/1/23 20:54
加载中...