結果

問題 No.1005 BOT対策
ユーザー tsuchinagatsuchinaga
提出日時 2020-10-04 23:22:19
言語 TypeScript
(5.7.2)
結果
WA  
実行時間 -
コード長 804 bytes
コンパイル時間 7,619 ms
コンパイル使用メモリ 229,312 KB
実行使用メモリ 41,456 KB
最終ジャッジ日時 2024-12-31 16:22:25
合計ジャッジ時間 10,374 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 WA * 2
権限があれば一括ダウンロードができます

ソースコード

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