結果

問題 No.1058 素敵な数
ユーザー 👑 H20H20
提出日時 2021-11-25 18:27:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 248 ms / 2,000 ms
コード長 581 bytes
コンパイル時間 1,314 ms
コンパイル使用メモリ 86,660 KB
実行使用メモリ 198,160 KB
最終ジャッジ日時 2023-09-10 20:01:30
合計ジャッジ時間 4,084 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 244 ms
198,160 KB
testcase_01 AC 248 ms
198,016 KB
testcase_02 AC 247 ms
198,104 KB
testcase_03 AC 236 ms
197,956 KB
testcase_04 AC 246 ms
197,900 KB
testcase_05 AC 238 ms
197,940 KB
testcase_06 AC 236 ms
198,044 KB
testcase_07 AC 230 ms
197,964 KB
testcase_08 AC 232 ms
197,952 KB
testcase_09 AC 230 ms
198,124 KB
権限があれば一括ダウンロードができます

ソースコード

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 = list(set(ANS))
ANS.sort()
print(ANS[N-1])
0