兰聪


私信TA

用户名:lc2024228712

访问量:2769

签 名:

等  级
排  名 143
经  验 7159
参赛次数 8
文章发表 18
年  龄 0
在职情况 学生
学  校 鄂州职业大学
专  业

  自我简介:

参考代码:

import java.util.Scanner;

public class 密码 {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		for (int i = 0; i < n; i++) {
			String str = sc.next();
			
			if(str.length() < 8 && str.length() > 16) {
				System.out.println("NO");
				return;
			}
			
			char[] arr = {'~','!','@','#','$','%','^'};
			
			int count = 0;
			
			for (int x = 0; x < str.length(); x++) {
				if(str.charAt(x) >= 'A' && str.charAt(x) <= 'Z') {
					count++;
					break;
				}
			}
			
			for (int x = 0; x < str.length(); x++) {
				if(str.charAt(x) >= 'a' && str.charAt(x) <= 'z') {
					count++;
					break;
				}
			}
			
			for (int x = 0; x < str.length(); x++) {
				if(str.charAt(x) >= '0' && str.charAt(x) <= '9') {
					count++;
					break;
				}
			}
			
			For:for (int x = 0; x < arr.length; x++) {
				for (int j = 0; j < str.length(); j++) {
					if(arr[x] == str.charAt(j)) {
						count++;
						break For;
					}
				}
			}
			
			if(count >= 3) {
				System.out.println("YES");
			}else {
				System.out.println("NO");
			}
		}
	}
	
}


 

0.0分

2 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区