結果
| 問題 |
No.1005 BOT対策
|
| コンテスト | |
| ユーザー |
knk_kei
|
| 提出日時 | 2021-02-03 02:11:37 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 2,000 ms |
| コード長 | 418 bytes |
| コンパイル時間 | 399 ms |
| コンパイル使用メモリ | 12,032 KB |
| 実行使用メモリ | 10,240 KB |
| 最終ジャッジ日時 | 2025-06-20 01:27:26 |
| 合計ジャッジ時間 | 2,273 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
s = input()
t = input()
"""
sに連続列としてtが含まれないようにしたい
何個.が必要?
tの数を純粋に数えるとs=aaaaaaa,t=aaaみたいな時に辛い。
尺取みたいにする
"""
idx = 0
ans = 0
lt, ls = len(t), len(s)
while idx + lt <= ls:
if s[idx : idx + lt] == t:
ans += 1
idx += max(lt - 2, 0)
idx += 1
if lt == 1 and t in s:
print(-1)
else:
print(ans)
knk_kei