結果

問題 No.1058 素敵な数
ユーザー ronpooronpoo
提出日時 2023-09-26 15:16:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 92 ms / 2,000 ms
コード長 529 bytes
コンパイル時間 881 ms
コンパイル使用メモリ 86,776 KB
実行使用メモリ 76,840 KB
最終ジャッジ日時 2023-09-26 15:16:34
合計ジャッジ時間 2,293 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
76,352 KB
testcase_01 AC 92 ms
76,484 KB
testcase_02 AC 89 ms
76,344 KB
testcase_03 AC 88 ms
76,488 KB
testcase_04 AC 87 ms
76,500 KB
testcase_05 AC 87 ms
76,324 KB
testcase_06 AC 87 ms
76,840 KB
testcase_07 AC 87 ms
76,424 KB
testcase_08 AC 87 ms
76,840 KB
testcase_09 AC 86 ms
76,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

def prime(x):
    prime = [True if x%2==1 else False for x in range(x+1)]
    prime[1] = False
    prime[2] = True

    for i in range(3, int(x**0.5)+2, 2):
        if prime[i]:
            for j in range(2*i, x+1, i):                
                prime[j] = False

    return prime

x = prime(10**5 + 100)
p = []
a = [1]
i = 10**5+1
for i in range(10**5+1, len(x)):
    if x[i]:
        p.append(i)

for i in range(len(p)-1):
    for j in range(i, len(p)):
        a.append(p[i]*p[j])
a.sort()
print(a[N-1])
0