题解 | #密码检查#
密码检查
https://www.nowcoder.com/practice/f2fbd8f61c564ca0b5feaa63ab42dae5
#include <stdio.h> #include <string.h> int main() { int n; scanf("%d", &n); char arr[1000] = {'\0'}; while (n--) { scanf("%s", arr); int len = strlen(arr); int flag[3]; if ((arr[0] < '9' && arr[0] > '0') || len < 8) { printf("NO\n"); continue; } for (int i = 0; i < len; i++) { if ((arr[i] < '9' && arr[i] > '0') || (arr[i] > 'A' && arr[i] < 'z')) { if (arr[i] < '9' && arr[i] > '0') { flag[0] = 1; } if (arr[i] > 'a' && arr[i] < 'z') { flag[1] = 1; } if (arr[i] > 'A' && arr[i] < 'Z') { flag[2] = 1; } } } if (flag[0] + flag[1] + flag[2] >= 2) { printf("YES\n"); } } return 0; }