結果

問題 No.1005 BOT対策
ユーザー integerinteger
提出日時 2020-05-02 13:39:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 462 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 10,952 KB
実行使用メモリ 8,012 KB
最終ジャッジ日時 2023-08-28 16:36:41
合計ジャッジ時間 1,981 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 16 ms
7,824 KB
testcase_05 WA -
testcase_06 AC 15 ms
7,960 KB
testcase_07 AC 16 ms
7,968 KB
testcase_08 AC 16 ms
7,880 KB
testcase_09 AC 16 ms
7,848 KB
testcase_10 AC 15 ms
7,812 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 15 ms
7,872 KB
testcase_19 AC 15 ms
7,872 KB
testcase_20 AC 15 ms
7,864 KB
testcase_21 AC 16 ms
7,792 KB
testcase_22 AC 15 ms
7,904 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 16 ms
7,904 KB
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    s = input()
    t = input()
    ans = solve(s, t)
    print(ans)


def solve(s, t):
    ls, lt = len(s), len(t)
    if ls < lt:
        return 0
    if lt == 1:
        if t in s:
            return -1
        else:
            return 0
    ans = 0
    i = 0
    while i < ls - lt + 1:
        if s[i:i + lt] != t:
            ans += 1
            i += lt - 1
        else:
            i += 1
    return ans

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