参考代码:
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语言代码)浏览:1298 |
C语言程序设计教程(第三版)课后习题11.11 (C语言代码)浏览:768 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:653 |
字符串输入输出函数 (C++代码)(都当成字符串吧hhhhhhhh)浏览:493 |
C语言程序设计教程(第三版)课后习题8.3 (C语言代码)浏览:702 |
三角形 (C++代码)递推浏览:755 |
C语言训练-自由落体问题 (C语言代码)浏览:610 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:606 |
1035 题解浏览:778 |
The 3n + 1 problem (C语言代码)浏览:501 |