結果

問題 No.1058 素敵な数
ユーザー jensenjensen
提出日時 2021-01-14 10:16:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 522 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 10,904 KB
実行使用メモリ 8,072 KB
最終ジャッジ日時 2023-08-15 15:44:54
合計ジャッジ時間 1,031 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,072 KB
testcase_01 AC 16 ms
7,900 KB
testcase_02 AC 17 ms
7,856 KB
testcase_03 AC 17 ms
8,072 KB
testcase_04 AC 17 ms
7,944 KB
testcase_05 AC 17 ms
8,016 KB
testcase_06 AC 16 ms
7,916 KB
testcase_07 AC 16 ms
7,948 KB
testcase_08 AC 17 ms
8,072 KB
testcase_09 AC 17 ms
7,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

n=int(input())
if(n==1):
    print(1)
else:
    
    i=0
    pri=[]
    pris=[]
    x=10**5
    while(i<9):
        x+=1
        if(is_prime(
            x)==True):
            pri.append(x)
            i+=1
    for i in range(9):
        for j in range(i,8):
            p=pri[i]*pri[j]
            pris.append(p)
    pris.sort()
    print(pris[n-2])
0