結果

問題 No.1058 素敵な数
ユーザー convexineqconvexineq
提出日時 2020-05-22 21:27:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 861 bytes
コンパイル時間 115 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,972 KB
最終ジャッジ日時 2024-04-15 15:47:13
合計ジャッジ時間 1,125 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

def Eratosthenes(N): #N以下の素数のリストを返す
    #iが素数のときis_prime_list[i]=1,それ以外は0
    N+=1
    is_prime_list = [True]*N
#    is_prime_list[0], is_prime_list[1] = False, False #リストが必要なときはこの2行を有効化
#    for j in range(4,N,2): is_prime_list[j] = False
    m = int(N**0.5)+1
    for i in range(3,m,2):
        if is_prime_list[i]:
            is_prime_list[i*i::2*i]=[False]*((N-i*i-1)//(2*i)+1)
    return [2] + [i for i in range(3,N,2) if is_prime_list[i]]
#    return is_prime_list

# coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read

#a,b = [int(i) for i in readline().split()]

n = int(input())
V = 10**5
p = Eratosthenes(V+10**3)
x = [i for i in p if i >= V]

res = [i*j for i in x for j in x] + [1]

res.sort()

print(res[n-1])











0