結果

問題 No.1058 素敵な数
ユーザー titiatitia
提出日時 2020-05-22 21:35:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 563 bytes
コンパイル時間 140 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 14,976 KB
最終ジャッジ日時 2024-04-15 16:12:21
合計ジャッジ時間 1,620 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
14,976 KB
testcase_01 AC 79 ms
14,848 KB
testcase_02 AC 84 ms
14,848 KB
testcase_03 AC 83 ms
14,848 KB
testcase_04 AC 78 ms
14,848 KB
testcase_05 AC 76 ms
14,848 KB
testcase_06 AC 75 ms
14,848 KB
testcase_07 AC 79 ms
14,848 KB
testcase_08 AC 81 ms
14,976 KB
testcase_09 AC 76 ms
14,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

x=10**5+100
import math 
L=math.floor(math.sqrt(x)) # 平方根を求める

Primelist=[i for i in range(x+1)]
Primelist[1]=0 # 1は素数でないので0にする.
 
for i in Primelist:
    if i>L:
        break
    if i==0:
        continue
    for j in range(2*i,x+1,i):
        Primelist[j]=0

Primes=[Primelist[j] for j in range(x+1) if Primelist[j]!=0]
P=[p for p in Primes if p>10**5]

ANS=[1]
for i in range(len(P)):
    for j in range(i,len(P)):
        ANS.append(P[i]*P[j])
ANS.sort()

print(ANS[int(input())-1])
0