結果

問題 No.430 文字列検索
ユーザー PalearcticPalearctic
提出日時 2018-09-21 20:23:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 559 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 10,952 KB
実行使用メモリ 16,516 KB
最終ジャッジ日時 2023-09-25 10:48:25
合計ジャッジ時間 3,714 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
16,516 KB
testcase_01 TLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

S=input()
M=int(input())
A=[]
for i in range(M):
    A.append(input())

def text_hash(text):
    sum=0
    for i in text:
        sum+=ord(i)%100
    return sum%100

def text_search(text,search):
    num=0
    search_hash=text_hash(search)

    for i in range(len(text)-len(search)+1):
        if(text_hash(text[i:i+len(search)])==search_hash):
            for j in range(len(search)):
                if(text[i+j]!=search[j]):
                    break
            else:
                num+=1
    return num

k=0
for i in A:
    k+=text_search(S,i)
print(k)
0