結果
問題 |
No.430 文字列検索
|
ユーザー |
|
提出日時 | 2022-02-02 16:12:31 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 159 ms / 2,000 ms |
コード長 | 390 bytes |
コンパイル時間 | 215 ms |
コンパイル使用メモリ | 81,964 KB |
実行使用メモリ | 140,800 KB |
最終ジャッジ日時 | 2024-11-10 00:59:17 |
合計ジャッジ時間 | 2,102 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 14 |
ソースコード
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)