結果
| 問題 |
No.8015 アンチローリングハッシュ
|
| ユーザー |
norioc
|
| 提出日時 | 2025-03-23 22:34:19 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 78 ms / 2,000 ms |
| コード長 | 442 bytes |
| コンパイル時間 | 319 ms |
| コンパイル使用メモリ | 82,632 KB |
| 実行使用メモリ | 71,856 KB |
| 最終ジャッジ日時 | 2025-03-23 22:34:23 |
| 合計ジャッジ時間 | 3,220 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 21 |
ソースコード
from string import ascii_lowercase
import random
def myhash(s: str, b, mod):
h = 0
for c in s:
h = h*b + ord(c)
h %= mod
return h
def gen_str(n: int) -> str:
return ''.join(random.choices(ascii_lowercase, k=n))
A, B = map(int, input().split())
used = {}
k = 30
while 1:
s = gen_str(k)
h = myhash(s, A, B)
if h in used:
print(s)
print(used[h])
break
used[h] = s
norioc