結果

問題 No.1005 BOT対策
コンテスト
ユーザー tamato
提出日時 2020-03-06 21:28:31
言語 PyPy3
(8.0.1 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 35 ms / 2,000 ms
+ 106µs
コード長 503 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,215 ms
コンパイル使用メモリ 64,000 KB
実行使用メモリ 53,600 KB
最終ジャッジ日時 2026-11-06 00:28:53
合計ジャッジ時間 4,154 ms
ジャッジサーバーID
(参考情報)
judge7_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def main():
    import sys
    input = sys.stdin.readline

    S = input().rstrip('\n')
    T = input().rstrip('\n')
    nt = len(T)
    N = len(S)

    if len(T) == 1:
        if S.count(T) > 0:
            print(-1)
        else:
            print(0)
        exit()

    i = 0
    ans = 0
    while True:
        if S[i:i+nt] == T:
            ans += 1
            i = i+nt-1
        else:
            i += 1
        if i >= N:
            break
    print(ans)


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