/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 320.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;

/// .................... type def
using ll = long long;
using ull = unsigned long long;
using ld = long double;

const ll N = 1e5+5;
int prime[N];
void seive(ll n){
    n+=2;
    int sqn = sqrt(n)+1;
    for(int i=4;i<=n;i+=2) prime[i]=1;
    for(int i=3;i<=sqn;i+=2){
        if(prime[i]==1) continue;
        for(int j=i+i;j<=n;j+=i) prime[j]=1;
    }
}

int popcount(ll x)
{
    int cnt=0;
    for(int i=0;i<64;i++) if((x&(1ull<<i))!=0) ++cnt;  return cnt;   
}

void solve()
{
    string s; cin>>s;
    int n=s.size();
    if(n<8) {cout<<"invalid"<<endl; return;}
    bool lower=false,upper=false,digit=false,special=false;
    for(auto &x:s)
    {
        lower |=(x>='a' && x<='z');
        upper |=(x>='A' && x<='Z');
        digit |=(x<='9' && x>='0');
        special |=(x=='[' || x==']' || x=='!' || x=='@' || x=='#' || x=='$' || x=='%' || x=='^' || x=='&' || x=='*' || x=='(' || x==')');
    }

    if(lower && upper && digit && special) cout<<"valid"<<endl;
    else cout<<"invalid"<<endl;
}


int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int t; cin>>t; while(t--) solve();
}

Information

Submit By
Type
Submission
Problem
P1007 Password Checker
Contest
Beta Round #1
Language
C++17 (G++ 13.2.0)
Submit At
2023-11-29 16:11:25
Judged At
2024-11-11 03:51:11
Judged By
Score
100
Total Time
2ms
Peak Memory
320.0 KiB