結果

問題 No.1058 素敵な数
ユーザー TakoKurageTakoKurage
提出日時 2020-05-23 04:23:31
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
実行時間 -
コード長 433 bytes
コンパイル時間 442 ms
コンパイル使用メモリ 10,796 KB
実行使用メモリ 18,700 KB
最終ジャッジ日時 2023-07-28 18:25:55
合計ジャッジ時間 4,213 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 262 ms
18,512 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

N = int(input())
P = primes(10 ** 6)[:N]

A = [1] + sorted(x * y for x, y in combinations(P, 2))

print(A[N - 1])
0