結果

問題 No.1058 素敵な数
ユーザー tamatotamato
提出日時 2020-05-22 21:25:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 58 ms / 2,000 ms
コード長 712 bytes
コンパイル時間 247 ms
コンパイル使用メモリ 82,576 KB
実行使用メモリ 58,380 KB
最終ジャッジ日時 2024-04-15 15:43:33
合計ジャッジ時間 1,268 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
52,712 KB
testcase_01 AC 45 ms
58,176 KB
testcase_02 AC 47 ms
57,780 KB
testcase_03 AC 47 ms
57,980 KB
testcase_04 AC 53 ms
57,452 KB
testcase_05 AC 53 ms
57,988 KB
testcase_06 AC 49 ms
58,380 KB
testcase_07 AC 52 ms
58,136 KB
testcase_08 AC 58 ms
57,588 KB
testcase_09 AC 53 ms
57,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    if N == 1:
        print(1)
        exit()

    cnt = N-1
    M = 10**5+1
    M_list = []
    while True:
        flg = 0
        for i in range(2, 10**5+1):
            if M % i == 0:
                flg = 1
                break
        if flg:
            M += 1
        else:
            cnt -= 1
            M_list.append(M)
            if cnt == 0:
                break
            M += 1

    L = []
    for i in range(len(M_list)):
        for j in range(i, len(M_list)):
            L.append(M_list[i] * M_list[j])
    L.sort()
    print(L[N-2])


if __name__ == '__main__':
    main()
0