結果
| 問題 | No.8015 アンチローリングハッシュ |
| ユーザー |
titia
|
| 提出日時 | 2026-02-25 07:08:59 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 378 bytes |
| 記録 | |
| コンパイル時間 | 419 ms |
| コンパイル使用メモリ | 77,888 KB |
| 実行使用メモリ | 74,112 KB |
| 最終ジャッジ日時 | 2026-02-25 07:09:07 |
| 合計ジャッジ時間 | 6,732 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | WA * 21 |
ソースコード
from random import choice,randint
a,b=list(map(int,input().split()))
def hash(S):
ANS=0
now=1
for i in range(len(S)):
ANS=(ANS+ord(S[i])*now)%b
now*=a
return ANS
S="a"
h=hash(S)
X="abcdefghijklmnopqrstuvwxyz"
while True:
T=""
for i in range(randint(1,100)):
T+=choice(X)
if hash(T)==h:
break
print(S)
print(T)
titia