結果

問題 No.2201 p@$$w0rd
ユーザー bluemeganebluemegane
提出日時 2023-02-04 07:10:49
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 1,190 bytes
コンパイル時間 1,152 ms
コンパイル使用メモリ 63,044 KB
実行使用メモリ 22,504 KB
最終ジャッジ日時 2023-09-16 04:10:31
合計ジャッジ時間 4,103 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
20,364 KB
testcase_01 AC 55 ms
22,496 KB
testcase_02 AC 53 ms
20,504 KB
testcase_03 AC 53 ms
20,424 KB
testcase_04 AC 54 ms
20,440 KB
testcase_05 AC 53 ms
20,436 KB
testcase_06 AC 54 ms
22,472 KB
testcase_07 AC 53 ms
22,448 KB
testcase_08 AC 53 ms
20,392 KB
testcase_09 AC 53 ms
20,532 KB
testcase_10 AC 53 ms
22,472 KB
testcase_11 AC 54 ms
20,460 KB
testcase_12 AC 53 ms
20,432 KB
testcase_13 AC 53 ms
20,420 KB
testcase_14 AC 54 ms
20,460 KB
testcase_15 AC 53 ms
22,452 KB
testcase_16 AC 55 ms
22,504 KB
testcase_17 AC 53 ms
20,616 KB
testcase_18 AC 54 ms
20,504 KB
testcase_19 AC 53 ms
20,428 KB
testcase_20 AC 54 ms
20,440 KB
testcase_21 AC 55 ms
18,496 KB
testcase_22 AC 53 ms
22,484 KB
testcase_23 AC 55 ms
22,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using static System.Math;
using System.Collections.Generic;
using System.Linq;
using System;

public class Hello
{
    static void Main()
    {
        var s = Console.ReadLine().Trim();
        getAns(s);
    }
    static bool check(string t)
    {
        var a = 0;
        var b = 0;
        var c = 0;
        for (int i = 0; i < 8; i++)
        {
            var ta = t[i] - '0';
            var tb = t[i] - 'a';
            if (ta >= 0 && ta <= 9) a++;
            else if (tb >= 0 && tb <= 25) b++;
            else c++;
        }
        return a > 0 && b > 0 && c > 0;
    }
    static void getAns(string s)
    {
        var a = "loas";
        var b = "10@$";
        var ans = 0;
        var q = new Queue<string>();
        q.Enqueue("");
        while (q.Count > 0)
        {
            var w = q.Dequeue();
            var wL = w.Length;
            if (wL == 8)
            {
                if (check(w)) ans++;
                continue;
            }
            q.Enqueue(w + s[wL]);
            for (int i = 0; i < 4; i++)
            {
                if (s[wL] == a[i]) { q.Enqueue(w + b[i]); break; }
            }
        }
        Console.WriteLine(ans);
    }
}
0