/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 284.0 KiB

Code

#include <stdio.h>
#include <string.h>
int main() {
   int t;
   scanf("%d",&t);
   for(int j=0;j<t;j++){
       char str[101];
       scanf("%s",&str);
       int lwr=0,upr=0,dgt=0,sp_char=0;
       for(int i=0;i<strlen(str);i++){
           if(str[i]>='a' && str[i]<='z'){
               lwr=1;
           }
           else if(str[i]>='A' && str[i]<='Z'){
               upr=1;
           }
           else if(str[i]>='0' && str[i]<='9'){
               dgt=1;
           }
           else if(str[i]=='!' || str[i]=='@' ||str[i]=='#' || str[i]=='$' ||
                    str[i]=='%' || str[i]=='^' || str[i]=='&' || str[i]=='*' || str[i]=='(' || str[i]==')'){
                         sp_char=1;
                       }
       }
        if (strlen(str)>=8 && lwr && upr && dgt && sp_char) {
            printf("valid\n");
        } else {
            printf("invalid\n");
        }
   }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1007 Password Checker
Language
C99 (GCC 13.2.0)
Submit At
2023-12-31 14:29:54
Judged At
2024-11-11 03:46:16
Judged By
Score
100
Total Time
1ms
Peak Memory
284.0 KiB