結果
| 問題 | No.8015 アンチローリングハッシュ |
| ユーザー |
titia
|
| 提出日時 | 2026-02-25 07:11:06 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 419 bytes |
| 記録 | |
| コンパイル時間 | 303 ms |
| コンパイル使用メモリ | 77,792 KB |
| 実行使用メモリ | 74,108 KB |
| 最終ジャッジ日時 | 2026-02-25 07:11:27 |
| 合計ジャッジ時間 | 9,857 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | AC * 3 WA * 18 |
ソースコード
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
X="abcdefghijklmnopqrstuvwxyz"
length=50
S=""
for i in range(length):
S+=choice(X)
h=hash(S)
while True:
T=""
for i in range(length):
T+=choice(X)
if hash(T)==h:
break
print(S)
print(T)
titia