結果

問題 No.1005 BOT対策
ユーザー lemonlemon
提出日時 2021-05-02 17:29:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 563 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 10,724 KB
実行使用メモリ 8,504 KB
最終ジャッジ日時 2023-09-28 08:04:12
合計ジャッジ時間 1,591 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,372 KB
testcase_01 AC 15 ms
8,372 KB
testcase_02 AC 16 ms
8,372 KB
testcase_03 AC 15 ms
8,288 KB
testcase_04 AC 18 ms
8,364 KB
testcase_05 AC 17 ms
8,352 KB
testcase_06 AC 18 ms
8,380 KB
testcase_07 AC 18 ms
8,496 KB
testcase_08 AC 16 ms
8,504 KB
testcase_09 AC 16 ms
8,292 KB
testcase_10 AC 15 ms
8,360 KB
testcase_11 AC 15 ms
8,364 KB
testcase_12 AC 15 ms
8,368 KB
testcase_13 AC 14 ms
8,460 KB
testcase_14 AC 16 ms
8,380 KB
testcase_15 AC 15 ms
8,352 KB
testcase_16 AC 15 ms
8,372 KB
testcase_17 AC 14 ms
8,376 KB
testcase_18 AC 16 ms
8,448 KB
testcase_19 AC 17 ms
8,436 KB
testcase_20 AC 16 ms
8,352 KB
testcase_21 AC 15 ms
8,404 KB
testcase_22 AC 16 ms
8,340 KB
testcase_23 AC 16 ms
8,400 KB
testcase_24 AC 16 ms
8,352 KB
testcase_25 AC 15 ms
8,288 KB
testcase_26 AC 16 ms
8,288 KB
testcase_27 AC 15 ms
8,452 KB
testcase_28 AC 15 ms
8,364 KB
testcase_29 AC 15 ms
8,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, collections
 
sys.setrecursionlimit(500005)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

s = input()
t = input()

ans = s.count(t)

if ans:
    if len(t) == 1:
        ans = -1
    
    else:
        ls = len(s)
        lt = len(t)
        ans = 0
        i = 0
        j = i + lt
        while j <= ls:
            if s[i:j] == t:
                ans += 1
                i = j - 1
            else:
                i += 1

            j = i + lt



print(ans)
0