結果

問題 No.430 文字列検索
ユーザー 👑 rin204rin204
提出日時 2022-02-02 16:12:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 220 ms / 2,000 ms
コード長 390 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 86,988 KB
実行使用メモリ 141,732 KB
最終ジャッジ日時 2023-09-02 02:50:31
合計ジャッジ時間 3,346 ms
ジャッジサーバーID
(参考情報)
judge14 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,296 KB
testcase_01 AC 220 ms
141,732 KB
testcase_02 AC 115 ms
78,212 KB
testcase_03 AC 109 ms
78,148 KB
testcase_04 AC 72 ms
71,052 KB
testcase_05 AC 72 ms
71,368 KB
testcase_06 AC 73 ms
71,380 KB
testcase_07 AC 72 ms
71,348 KB
testcase_08 AC 176 ms
135,668 KB
testcase_09 AC 77 ms
75,848 KB
testcase_10 AC 88 ms
81,148 KB
testcase_11 AC 142 ms
86,612 KB
testcase_12 AC 142 ms
87,500 KB
testcase_13 AC 143 ms
87,248 KB
testcase_14 AC 130 ms
82,272 KB
testcase_15 AC 125 ms
80,112 KB
testcase_16 AC 110 ms
78,208 KB
testcase_17 AC 120 ms
78,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()
cnt = {}
n = len(S)
for i in range(n):
    tot = 0
    for j in range(10):
        if i + j == n:
            break
        tot *= 30
        tot += ord(S[i + j]) - 64
        cnt[tot] = cnt.get(tot, 0) + 1

ans = 0
m = int(input())
for _ in range(m):
    S = input()
    tot = 0
    for s in S:
        tot *= 30
        tot += ord(s) - 64
    ans += cnt.get(tot, 0)
print(ans)
0