結果

問題 No.1058 素敵な数
ユーザー maspymaspy
提出日時 2020-05-22 22:08:28
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 516 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 10,824 KB
実行使用メモリ 29,844 KB
最終ジャッジ日時 2023-07-28 07:40:46
合計ジャッジ時間 2,323 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

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