/ SeriousOJ /

Record Detail

Accepted


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

Code

// Bismillah hir-rahman nir-raheem
#include<bits/stdc++.h>
#include <tuple>
using namespace std;
#define   ll          long long
#define   pb          push_back
#define   ff          first
#define   ss          second
#define   tc()        ll t; cin>>t; while(t--)
#define   endll       "\n"
#define   coutall(v)  for(auto it: v) cout<<it<<' '; cout<<'\n'
#define   debug(x)    cout << " >> " << #x << " : " << x << endl
#define   yes         cout <<"YES\n"
#define   no          cout << "NO\n"
#define   PI          3.141592653589793238
#define   all(v)      (v).begin(),(v).end()
#define   _rasbaris_  ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
// cout << "Case "<<q<<": ";
using namespace std;
const ll M = 1e5;

// 4 direction
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};




int main()
{
    _rasbaris_

    tc()
    {
        string  s ;
        cin >> s ;

         if(s.size()>=8 )
        {


            ll x=0,y=0,z=0,q=0,ok=0;
            for( int i=0; s[i]; i++)
            {
                if(x==0 && isupper(s[i]))
                {
                    ok+=1;
                    x=1;

                }
                if(islower(s[i]) && y==0)
                {
                    ok+=1;
                    y=1;
                }
                if(z==0 && ((s[i]-'0')>=0 && (s[i]-'0')<=9)  )
                {
                    ok+=1;
                    z=1;
                }
                if(q==0 &&  (s[i]=='!' || s[i]=='@' || s[i]=='#' || s[i]=='*' || s[i]=='$' || s[i]=='%' || s[i]=='^' || s[i]=='&' || s[i]=='(' || s[i]==')' || s[i]=='[' || s[i]==']')  )
                {
                    q=1 ;
                    ok+=1;
                }

            }
            if(ok==4)cout<<"valid"<<endl;
            else cout <<"invalid"<<endl;
        }

        else cout <<"invalid"<<endl;


    }

    return 0 ;
}

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:19:42
Judged At
2024-10-03 14:11:12
Judged By
Score
100
Total Time
2ms
Peak Memory
556.0 KiB