解题思路:10分钟AC,不解释,so easy!
1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 const int maxn = 55; 6 char str[maxn]; 7 int n; 8 int main() 9 { 10 scanf("%d", &n); 11 while(n--) 12 { 13 scanf("%s", str); 14 int len = strlen(str); 15 int cnt = 0; 16 int cnt1, cnt2, cnt3, cnt4; 17 cnt1 = cnt2 = cnt3 = cnt4 = 0; 18 for(int i = 0; i < len; i++) 19 { 20 if(str[i] >= ‘a‘ && str[i] <= ‘z‘) cnt1 = 1; 21 else if(str[i] >= ‘A‘ && str[i] <= ‘Z‘) cnt2 = 1; 22 else if(str[i] >= ‘0‘ && str[i] <= ‘9‘) cnt3 = 1; 23 else cnt4 = 1; 24 } 25 cnt = cnt1 + cnt2 + cnt3 + cnt4; 26 if(cnt >= 3 && len >=8 && len <= 16) printf("YES\n"); 27 else printf("NO\n"); 28 } 29 return 0; 30 }
时间: 2024-10-19 01:24:45