結果
問題 |
No.1058 素敵な数
|
ユーザー |
![]() |
提出日時 | 2020-05-23 04:27:57 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 243 ms / 2,000 ms |
コード長 | 467 bytes |
コンパイル時間 | 199 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 21,400 KB |
最終ジャッジ日時 | 2024-10-06 12:42:54 |
合計ジャッジ時間 | 3,625 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
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])