結果

問題 No.1005 BOT対策
ユーザー tsuchinagatsuchinaga
提出日時 2020-10-04 23:22:19
言語 TypeScript
(5.4.3)
結果
WA  
実行時間 -
コード長 804 bytes
コンパイル時間 7,255 ms
コンパイル使用メモリ 255,040 KB
実行使用メモリ 42,440 KB
最終ジャッジ日時 2023-09-27 00:42:25
合計ジャッジ時間 10,215 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
42,356 KB
testcase_01 AC 76 ms
42,256 KB
testcase_02 AC 75 ms
42,344 KB
testcase_03 AC 76 ms
42,284 KB
testcase_04 AC 75 ms
42,212 KB
testcase_05 AC 75 ms
42,316 KB
testcase_06 AC 73 ms
42,212 KB
testcase_07 AC 74 ms
42,300 KB
testcase_08 AC 74 ms
42,172 KB
testcase_09 AC 74 ms
42,156 KB
testcase_10 AC 73 ms
42,288 KB
testcase_11 AC 75 ms
42,168 KB
testcase_12 WA -
testcase_13 AC 75 ms
42,224 KB
testcase_14 AC 73 ms
42,196 KB
testcase_15 AC 78 ms
42,288 KB
testcase_16 AC 75 ms
42,260 KB
testcase_17 AC 74 ms
42,252 KB
testcase_18 AC 74 ms
42,188 KB
testcase_19 AC 76 ms
42,316 KB
testcase_20 AC 72 ms
42,220 KB
testcase_21 AC 74 ms
42,248 KB
testcase_22 AC 76 ms
42,204 KB
testcase_23 AC 74 ms
42,304 KB
testcase_24 AC 76 ms
42,340 KB
testcase_25 AC 75 ms
42,168 KB
testcase_26 AC 76 ms
42,164 KB
testcase_27 AC 76 ms
42,440 KB
testcase_28 WA -
testcase_29 AC 76 ms
42,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

function issue1005(input: string) {
    let inputs = input.trim().split("\n")
    let s: string = inputs[0]
    let t: string = inputs[1]

    // 先頭からマッチするところを探して、マッチしたらマッチした最後の文字の前に.を入れ、マッチした文字の最後の文字から確認を再開する
    let count = 0
    if (t.length == 1 && s.includes(t)) count = -1
    else {
        let head = 0
        while (head <= s.length - t.length) {
            if (s.substr(head, t.length) == t) {
                count++
                head += t.length - 1
            }
            head++
        }
    }
    console.log(count)
}

let path: string = "/dev/stdin"
if (process.platform == "win32") path = "./stdin.txt"
issue1005(require('fs').readFileSync(path, 'utf8'))
0