結果

問題 No.430 文字列検索
ユーザー ebicochinealebicochineal
提出日時 2016-10-22 00:50:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,017 ms / 2,000 ms
コード長 346 bytes
コンパイル時間 250 ms
コンパイル使用メモリ 10,736 KB
実行使用メモリ 8,340 KB
最終ジャッジ日時 2023-08-15 17:52:32
合計ジャッジ時間 8,824 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,808 KB
testcase_01 AC 338 ms
7,952 KB
testcase_02 AC 521 ms
8,100 KB
testcase_03 AC 388 ms
8,160 KB
testcase_04 AC 16 ms
7,920 KB
testcase_05 AC 16 ms
7,824 KB
testcase_06 AC 16 ms
7,856 KB
testcase_07 AC 15 ms
7,932 KB
testcase_08 AC 16 ms
8,252 KB
testcase_09 AC 16 ms
7,916 KB
testcase_10 AC 18 ms
7,924 KB
testcase_11 AC 1,017 ms
8,216 KB
testcase_12 AC 964 ms
8,184 KB
testcase_13 AC 957 ms
8,328 KB
testcase_14 AC 907 ms
8,248 KB
testcase_15 AC 877 ms
8,260 KB
testcase_16 AC 710 ms
8,340 KB
testcase_17 AC 711 ms
8,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#! /usr/bin/env python3

def f(s, t):
    p = 0
    cnt = 0
    while 1:
        p = s.find(t)
        if p >= 0:
            cnt += 1
            s = s[p+1:]
        else:
            break
    return cnt

def main():
    s = input()
    n = int(input())
    print(sum(f(s, input()) for _ in range(n)))
    
if __name__ == '__main__':
    main()
0