結果

問題 No.1058 素敵な数
ユーザー brthyyjp
提出日時 2020-05-24 05:34:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 621 bytes
コンパイル時間 818 ms
コンパイル使用メモリ 82,364 KB
実行使用メモリ 63,232 KB
最終ジャッジ日時 2024-10-10 02:25:48
合計ジャッジ時間 1,995 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

import math

def sieve(n):
    ass = []
    is_prime = [True]*(n+1)
    is_prime[0] = False
    is_prime[1] = False

    for i in range(2, int(math.sqrt(n))+1):
        if not is_prime[i]:
            continue
        for j in range(i*2, n+1, i):
            is_prime[j] = False
    for i in range(n+1):
        if is_prime[i]:
            ass.append(i)
    return(ass)

S = sieve(10**5)
T = sieve(2*10**5)
#print(len(S))
#print(len(T))
P = T[len(S):len(S)+10]
#print(P)
ans = [1]
for i in range(10):
    for j in range(10):
        ans.append(P[i]*P[j])
ans = list(set(ans))
ans.sort()
print(ans[n-1])
0