結果

問題 No.1058 素敵な数
ユーザー maspymaspy
提出日時 2020-05-22 22:08:28
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 516 bytes
コンパイル時間 189 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 44,592 KB
最終ジャッジ日時 2024-10-05 17:45:00
合計ジャッジ時間 6,315 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 1
other RE * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(read())

U = 10**5 + 1000
is_prime = np.zeros(U, np.bool)
is_prime[2] = 1
is_prime[3::2] = 1
for p in range(3, U, 2):
    if p * p > U:
        break
    if is_prime[p]:
        is_prime[p * p::p + p] = 0
primes = np.where(is_prime)[0]

primes = primes[primes > 10**5]

se = set(x * y for x in primes for y in primes)
se.add(1)

nums = sorted(se)[:10]

print(nums[N - 1])
0