結果

問題 No.1005 BOT対策
ユーザー 👑 tatyam
提出日時 2020-03-03 03:16:11
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 37 ms / 2,000 ms
コード長 466 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 12,160 KB
実行使用メモリ 10,112 KB
最終ジャッジ日時 2025-06-20 00:46:43
合計ジャッジ時間 2,211 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    s = input()
    t = input()
    n = len(s)
    m = len(t)
    assert(1 <= n <= 1000)
    assert(1 <= m <= 1000)
    assert(all(i.islower() for i in s))
    assert(all(i.islower() for i in t))
    if len(t) == 1:
        return -1 if t in s else 0
    ans = 0
    i = m
    while i <= n:
        if s[i-m:i] == t:
            ans += 1
            i += m - 1
        else:
            i += 1
    return ans

if __name__ == '__main__':
    print(main())
0