結果

問題 No.1005 BOT対策
ユーザー aqua_tenhou
提出日時 2021-08-01 21:58:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 315 bytes
コンパイル時間 211 ms
コンパイル使用メモリ 82,524 KB
実行使用メモリ 54,008 KB
最終ジャッジ日時 2025-06-20 01:38:10
合計ジャッジ時間 2,503 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

s = list(input())
t = list(input())
n,m = len(s), len(t)

if m == 1:
    if t[0] in s:
        print(-1)
    else:
        print(0)
    exit()

if m > n:
    print(0)
    exit()

s += ["0"]*1001
ans = 0
i = 0
while i < n:
    if s[i:i+m] == t:
        ans += 1
        i += m-1
    else:
        i += 1

print(ans)
0