結果
問題 | No.6 使いものにならないハッシュ |
ユーザー |
![]() |
提出日時 | 2024-02-25 22:31:54 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 870 bytes |
コンパイル時間 | 261 ms |
コンパイル使用メモリ | 82,456 KB |
実行使用メモリ | 104,832 KB |
最終ジャッジ日時 | 2024-09-29 11:24:15 |
合計ジャッジ時間 | 4,571 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 RE * 1 |
ソースコード
def seachPrimeNum(N):if N == 2:return []max = int(N ** 0.5)seachList = [i for i in range(2, N + 1)]primeNum = []while seachList[0] <= max:primeNum.append(seachList[0])tmp = seachList[0]seachList = [i for i in seachList if i % tmp != 0]primeNum.extend(seachList)return primeNumfrom bisect import bisect_leftK = int(input())N = int(input())PL = seachPrimeNum(N)k = bisect_left(PL, K)X = [-1] * 10def f(x):while x >= 10:ret = 0while x > 0:ret += x % 10x //= 10x = retreturn xn = len(PL)i = n - 1tmp2 = 0tmp = n - 1while i >= k:h = f(PL[i])if X[h] != -1:if tmp >= X[h]:tmp = X[h] - 1X[h] = iif tmp2 < tmp - i + 1:tmp2 = tmp - i + 1ans = PL[i]i -= 1print(ans)