結果

問題 No.1058 素敵な数
ユーザー r_ishidar_ishida
提出日時 2021-01-23 22:22:33
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 16 ms / 2,000 ms
コード長 887 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 10,948 KB
実行使用メモリ 8,012 KB
最終ジャッジ日時 2023-08-30 07:05:13
合計ジャッジ時間 1,304 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,844 KB
testcase_01 AC 16 ms
7,884 KB
testcase_02 AC 16 ms
8,012 KB
testcase_03 AC 16 ms
7,816 KB
testcase_04 AC 16 ms
7,904 KB
testcase_05 AC 16 ms
7,876 KB
testcase_06 AC 16 ms
7,820 KB
testcase_07 AC 15 ms
7,848 KB
testcase_08 AC 16 ms
7,824 KB
testcase_09 AC 16 ms
7,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

def is_prime(p):
    if p == 1:
        return 0
    for k in range(2, int(p**0.5) + 1):
        if p%k == 0:
            return 0
    else:
        return 1



n = I()
if n == 1:
    print(1)
else:
    cnt = 0
    m = 10**5+1
    pr = []
    while cnt <= 10:
        if is_prime(m) == 1:
            pr.append(m)
            cnt += 1
            m += 1
        else:
            m += 1

    ans = []
    for i in range(10):
        for j in range(10):
            ans.append(pr[i]*pr[j])
    
    ans = sorted(set(ans))

    print(ans[n-2])
0