参考代码:
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 人评分
数列 (C++代码)浏览:707 |
C语言程序设计教程(第三版)课后习题7.1 (C语言代码)浏览:1267 |
简单的a+b (C语言代码)浏览:626 |
DNA (C语言描述,蓝桥杯)浏览:1653 |
sizeof的大作用 (C语言代码)浏览:1590 |
C语言程序设计教程(第三版)课后习题9.3 (C语言代码)浏览:650 |
C二级辅导-计负均正 (C语言代码)浏览:523 |
交换Easy (C语言代码)浏览:805 |
A+B for Input-Output Practice (IV) (C语言代码)浏览:489 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:725 |