結果

問題 No.1058 素敵な数
ユーザー 👑 H20H20
提出日時 2021-11-25 18:26:02
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 560 bytes
コンパイル時間 538 ms
コンパイル使用メモリ 87,384 KB
実行使用メモリ 138,556 KB
最終ジャッジ日時 2023-09-10 20:00:55
合計ジャッジ時間 3,474 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

def sieve(n):
    is_prime = [True for _ in range(n+1)]
    is_prime[0] = False

    for i in range(2, n+1):
        if is_prime[i-1]:
            j = 2 * i
            while j <= n:
                is_prime[j-1] = False
                j += i
    table = [ i for i in range(1, n+1) if is_prime[i-1]]
    return [False]+is_prime, table


N = int(input())
ANS = [1]
P,T = sieve(10**5+10000)
TEMP = []
for i in range(10**5+1,len(P)):
    if P[i]==True:
        TEMP.append(i)
for p in TEMP:
    for pp in TEMP:
        ANS.append(p*pp)
ANS.sort()
print(ANS[N-1])
0