結果

問題 No.2201 p@$$w0rd
ユーザー MAHAYANA
提出日時 2023-11-04 17:05:00
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 968 bytes
コンパイル時間 3,246 ms
コンパイル使用メモリ 250,740 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-25 22:09:05
合計ジャッジ時間 3,935 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'char change(char)':
main.cpp:16:1: warning: control reaches end of non-void function [-Wreturn-type]
   16 | }
      | ^

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,m,n) for(int i=m; i<n; ++i)
#define repl(i,m,n) for(ll i=m; i<n; ++i)

bool can_change(char c){
    return c == 'l' || c == 'o' || c == 'a' || c == 's';
}

char change(char c){
    if(c == 'l') return '1';
    else if(c == 'o') return '0';
    else if(c == 'a') return '@';
    else if(c == 's') return '$';
}

bool check(string &s){
    bool f1 = false, f2 = false, f3 = false;
    for(char &c : s){
        if('a' <= c && c <= 'z') f1 = true;
        if('0' <= c && c <= '9') f2 = true;
        if(c == '@' || c == '$') f3 = true;
    }
    return f1 & f2 & f3;
}

int main(){
    string S;
    cin >> S;

    set<string> st;
    rep(bit, 0, 1<<8){
        string T = S;
        rep(i, 0, 8){
            if(!can_change(T[i])) continue;
            if(bit & 1 << i) T[i] = change(T[i]);
        }
        if(check(T)) st.insert(T);
    }
    cout << st.size() << endl;

    return 0;
}
0