結果

問題 No.1058 素敵な数
ユーザー lloyzlloyz
提出日時 2022-03-02 00:17:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 500 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 86,980 KB
実行使用メモリ 84,360 KB
最終ジャッジ日時 2023-09-22 16:01:30
合計ジャッジ時間 2,189 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,308 KB
testcase_01 AC 118 ms
84,188 KB
testcase_02 AC 118 ms
84,272 KB
testcase_03 AC 121 ms
84,192 KB
testcase_04 AC 119 ms
84,360 KB
testcase_05 AC 119 ms
84,248 KB
testcase_06 AC 120 ms
84,084 KB
testcase_07 AC 118 ms
84,000 KB
testcase_08 WA -
testcase_09 AC 118 ms
84,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

if n == 1:
    print(1)
    exit()

n -= 2
IsPrime = [True for _ in range(10**6 + 1)]
IsPrime[0] = IsPrime[1] = False
for i in range(2, 10**6 + 1):
    if IsPrime[i]:
        for j in range(i + i, 10**6 + 1, i):
            IsPrime[j] = False

P = []
for i in range(10**5 + 1, 10**6 + 1):
    if IsPrime[i]:
        P.append(i)
        if len(P) == 5:
            break

ANS = []
for i in range(5):
    for j in range(i, 5):
        ANS.append(P[i] * P[j])
ANS.sort()
print(ANS[n])
0