結果

問題 No.1367 文字列門松
ユーザー bluemeganebluemegane
提出日時 2021-02-02 20:16:04
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 661 bytes
コンパイル時間 826 ms
コンパイル使用メモリ 65,528 KB
実行使用メモリ 23,292 KB
最終ジャッジ日時 2023-09-12 11:21:58
合計ジャッジ時間 3,876 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
21,360 KB
testcase_01 AC 68 ms
21,200 KB
testcase_02 AC 68 ms
23,268 KB
testcase_03 AC 68 ms
21,240 KB
testcase_04 AC 48 ms
22,544 KB
testcase_05 AC 68 ms
21,196 KB
testcase_06 AC 69 ms
21,304 KB
testcase_07 AC 69 ms
21,024 KB
testcase_08 AC 68 ms
23,152 KB
testcase_09 AC 68 ms
21,192 KB
testcase_10 AC 67 ms
23,184 KB
testcase_11 AC 67 ms
21,108 KB
testcase_12 AC 67 ms
23,292 KB
testcase_13 AC 68 ms
23,188 KB
testcase_14 AC 68 ms
21,208 KB
testcase_15 AC 68 ms
23,192 KB
testcase_16 AC 68 ms
21,120 KB
testcase_17 AC 67 ms
23,120 KB
testcase_18 AC 67 ms
23,140 KB
testcase_19 AC 68 ms
21,284 KB
testcase_20 AC 67 ms
21,288 KB
testcase_21 AC 70 ms
21,072 KB
testcase_22 AC 68 ms
20,956 KB
testcase_23 AC 69 ms
21,284 KB
testcase_24 AC 48 ms
20,572 KB
testcase_25 AC 68 ms
23,140 KB
testcase_26 AC 50 ms
20,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System.Collections.Generic;
using System;

public class Hello
{
    public static string t = "kadomatsu";
    static void Main()
    {
        var s = Console.ReadLine().Trim();
        Console.WriteLine(getAns(s) ? "Yes" : "No");
    }
    static bool getAns(string s)
    {
        var sL = s.Length;
        if (sL == 10) return false;
        if (sL == 9) return s == t;
        var test = new List<int>();
        var p = 0;
        for (int i = 0; i < sL; i++)
        {
            var w = t.IndexOf(s[i].ToString(), p);
            if (w == -1) return false;
            test.Add(w);
            p = w + 1;
        }
        return true;
    }
}
0