結果

問題 No.2298 yukicounter
ユーザー InIn
提出日時 2023-05-12 21:40:40
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 1,030 bytes
コンパイル時間 1,215 ms
コンパイル使用メモリ 156,760 KB
実行使用メモリ 5,332 KB
最終ジャッジ日時 2023-09-04 20:20:41
合計ジャッジ時間 3,495 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 10 ms
4,588 KB
testcase_04 AC 4 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 13 ms
5,052 KB
testcase_07 AC 4 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 4 ms
4,380 KB
testcase_12 AC 4 ms
4,376 KB
testcase_13 AC 4 ms
4,380 KB
testcase_14 AC 4 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 4 ms
4,376 KB
testcase_23 AC 3 ms
4,380 KB
testcase_24 AC 12 ms
5,332 KB
testcase_25 AC 6 ms
4,380 KB
testcase_26 AC 4 ms
4,380 KB
testcase_27 AC 10 ms
4,804 KB
testcase_28 AC 3 ms
4,376 KB
testcase_29 AC 3 ms
4,376 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 3 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

void main () {
    string S = readln.split[0];

    solve(S);
}

void solve (string S) {
    int ans = 0;

    while ("yukicoder".length <= S.length) {
        if (S[0] == 'y') {
            auto tmp = HowMany_included(S, "yukicoder");
            ans = tmp > ans ? tmp : ans;
        } else {
            S = S[1..$];
        }
    }

    writeln(ans);
}

int HowMany_included (ref string base, string key) {
    if (base.length < key.length) {
        return 0;
    }

    int ret = 0;
    while (key.length <= base.length) {
        bool is_included = true;
        int cut = -1;
        foreach (j; 0..key.length) {
            if (base[j] != key[j]) {
                is_included = false;
                cut = cast(int)j;
                break;
            }
        }
        if (cut == -1) {
            base = base[9..$];
        } else {
            base = base[cut + 1..$];
        }
        if (is_included) {
            ret++;
        } else {
            return ret;
        }
    }

    return ret;
}
0