結果

問題 No.2201 p@$$w0rd
ユーザー bluemeganebluemegane
提出日時 2023-02-04 07:08:38
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 1,316 bytes
コンパイル時間 1,274 ms
コンパイル使用メモリ 65,188 KB
実行使用メモリ 22,576 KB
最終ジャッジ日時 2023-09-16 04:08:38
合計ジャッジ時間 3,917 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
20,500 KB
testcase_01 AC 54 ms
22,504 KB
testcase_02 AC 52 ms
20,412 KB
testcase_03 AC 51 ms
20,456 KB
testcase_04 AC 51 ms
20,528 KB
testcase_05 AC 52 ms
22,536 KB
testcase_06 AC 52 ms
20,404 KB
testcase_07 AC 52 ms
20,416 KB
testcase_08 AC 53 ms
20,480 KB
testcase_09 AC 50 ms
20,456 KB
testcase_10 AC 53 ms
20,484 KB
testcase_11 AC 52 ms
18,492 KB
testcase_12 AC 51 ms
20,480 KB
testcase_13 AC 51 ms
20,516 KB
testcase_14 AC 51 ms
22,540 KB
testcase_15 AC 50 ms
22,432 KB
testcase_16 AC 50 ms
20,416 KB
testcase_17 AC 51 ms
18,564 KB
testcase_18 AC 50 ms
20,568 KB
testcase_19 AC 51 ms
20,572 KB
testcase_20 AC 50 ms
20,492 KB
testcase_21 AC 51 ms
22,576 KB
testcase_22 AC 51 ms
20,456 KB
testcase_23 AC 51 ms
20,496 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("" + s[0]);
        for (int i = 0; i < 4; i++)
        {
            if (s[0] == a[i]) { q.Enqueue("" + b[i]); break; }
        }
        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