結果

問題 No.1005 BOT対策
ユーザー tsuchinagatsuchinaga
提出日時 2020-10-04 23:24:11
言語 TypeScript
(5.4.3)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 797 bytes
コンパイル時間 6,693 ms
コンパイル使用メモリ 256,584 KB
実行使用メモリ 44,432 KB
最終ジャッジ日時 2023-09-27 00:42:46
合計ジャッジ時間 10,142 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
42,324 KB
testcase_01 AC 73 ms
42,220 KB
testcase_02 AC 73 ms
42,312 KB
testcase_03 AC 74 ms
42,392 KB
testcase_04 AC 75 ms
42,352 KB
testcase_05 AC 74 ms
42,388 KB
testcase_06 AC 74 ms
42,380 KB
testcase_07 AC 72 ms
42,180 KB
testcase_08 AC 73 ms
42,376 KB
testcase_09 AC 74 ms
42,260 KB
testcase_10 AC 75 ms
42,236 KB
testcase_11 AC 74 ms
42,184 KB
testcase_12 AC 77 ms
42,308 KB
testcase_13 AC 74 ms
42,188 KB
testcase_14 AC 75 ms
42,196 KB
testcase_15 AC 74 ms
42,340 KB
testcase_16 AC 75 ms
44,432 KB
testcase_17 AC 74 ms
42,408 KB
testcase_18 AC 75 ms
42,388 KB
testcase_19 AC 74 ms
42,444 KB
testcase_20 AC 75 ms
42,212 KB
testcase_21 AC 73 ms
42,212 KB
testcase_22 AC 74 ms
42,264 KB
testcase_23 AC 74 ms
42,208 KB
testcase_24 AC 75 ms
42,244 KB
testcase_25 AC 74 ms
42,432 KB
testcase_26 AC 74 ms
42,232 KB
testcase_27 AC 74 ms
42,372 KB
testcase_28 AC 74 ms
42,296 KB
testcase_29 AC 73 ms
42,332 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
            } else head++
        }
    }
    console.log(count)
}

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