結果
問題 |
No.1005 BOT対策
|
ユーザー |
![]() |
提出日時 | 2020-10-04 23:24:11 |
言語 | TypeScript (5.7.2) |
結果 |
AC
|
実行時間 | 57 ms / 2,000 ms |
コード長 | 797 bytes |
コンパイル時間 | 8,197 ms |
コンパイル使用メモリ | 262,076 KB |
実行使用メモリ | 42,496 KB |
最終ジャッジ日時 | 2025-06-20 00:54:32 |
合計ジャッジ時間 | 10,924 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
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'))