結果

問題 No.1058 素敵な数
ユーザー 👑 H20H20
提出日時 2021-11-25 18:25:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 559 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 79,468 KB
最終ジャッジ日時 2023-09-10 19:59:27
合計ジャッジ時間 1,974 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
79,300 KB
testcase_01 AC 88 ms
79,208 KB
testcase_02 AC 90 ms
79,204 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+2000)
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