結果

問題 No.1005 BOT対策
コンテスト
ユーザー stng
提出日時 2022-08-18 10:45:49
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 397 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 123 ms
コンパイル使用メモリ 85,120 KB
実行使用メモリ 58,496 KB
最終ジャッジ日時 2026-04-21 07:31:56
合計ジャッジ時間 1,983 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

s = input()
t = input()
num = s.count(t)
if len(t) == 1 and num > 0:
    print(-1)
    exit()

tidx = 0
sidx = 0
ans = 0
for i in range(len(s)*2):
    if sidx >= len(s):
        break
    if s[sidx] == t[tidx]:
        if tidx == len(t)-1:
            ans += 1
            tidx = 0
        else:
            tidx += 1
            sidx += 1
    else:
        tidx = 0
        sidx += 1

print(ans)
0