結果

問題 No.1058 素敵な数
ユーザー r_ishidar_ishida
提出日時 2021-01-23 22:17:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 856 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 10,852 KB
実行使用メモリ 8,028 KB
最終ジャッジ日時 2023-08-30 06:41:44
合計ジャッジ時間 1,013 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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(i, 10):
            ans.append(pr[i]*pr[j])

    print(ans[n-1])
0