結果

問題 No.8015 アンチローリングハッシュ
ユーザー titia
提出日時 2026-02-25 07:10:24
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 426 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 367 ms
コンパイル使用メモリ 78,404 KB
実行使用メモリ 74,156 KB
最終ジャッジ日時 2026-02-25 07:10:44
合計ジャッジ時間 9,169 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other AC * 1 WA * 17 TLE * 1 -- * 2
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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"

length=50
S=""
for i in range(length):
    S+=choice(X)
while True:
    T=""
    for i in range(length):
        T+=choice(X)

    if hash(T)==h:
        break

print(S)
print(T)
0