結果

問題 No.1058 素敵な数
コンテスト
ユーザー TakoKurage
提出日時 2020-05-23 04:27:57
言語 Python3
(3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 146 ms / 2,000 ms
+ 891µs
コード長 467 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 56 ms
コンパイル使用メモリ 15,360 KB
実行使用メモリ 21,632 KB
最終ジャッジ日時 2026-09-11 02:58:53
合計ジャッジ時間 2,983 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def primes(n):
    memo = [True] * (n + 1)
    i = 2
    while i * i <= n:
        if memo[i]:
            j = i << 1
            while j <= n:
                memo[j] = False
                j += i
        i += 1
    return [i for i in range(n + 1) if memo[i] and i >= 10 ** 5 + 1]

from itertools import combinations_with_replacement

N = int(input())

P = primes(10 ** 6)[:N]
A = [1] + sorted(x * y for x, y in combinations_with_replacement(P, 2))

print(A[N - 1])
0