結果

問題 No.1005 BOT対策
コンテスト
ユーザー stng
提出日時 2022-08-18 10:45:49
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 397 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 79 ms
コンパイル使用メモリ 81,024 KB
実行使用メモリ 60,928 KB
最終ジャッジ日時 2026-09-10 20:05:42
合計ジャッジ時間 2,703 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_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