結果

問題 No.1058 素敵な数
ユーザー brthyyjpbrthyyjp
提出日時 2020-05-24 05:34:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 621 bytes
コンパイル時間 305 ms
コンパイル使用メモリ 82,440 KB
実行使用メモリ 64,728 KB
最終ジャッジ日時 2024-04-18 09:07:33
合計ジャッジ時間 1,470 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
63,344 KB
testcase_01 AC 52 ms
63,376 KB
testcase_02 AC 50 ms
64,728 KB
testcase_03 AC 51 ms
63,240 KB
testcase_04 AC 50 ms
63,900 KB
testcase_05 AC 52 ms
63,340 KB
testcase_06 AC 50 ms
64,268 KB
testcase_07 AC 51 ms
63,380 KB
testcase_08 AC 50 ms
63,392 KB
testcase_09 AC 52 ms
63,788 KB
権限があれば一括ダウンロードができます

ソースコード

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