結果

問題 No.1058 素敵な数
ユーザー 👑 tamatotamato
提出日時 2020-05-22 21:25:52
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 89 ms / 2,000 ms
コード長 712 bytes
コンパイル時間 412 ms
コンパイル使用メモリ 87,516 KB
実行使用メモリ 75,736 KB
最終ジャッジ日時 2023-07-28 06:16:12
合計ジャッジ時間 1,825 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,740 KB
testcase_01 AC 77 ms
75,648 KB
testcase_02 AC 79 ms
75,520 KB
testcase_03 AC 78 ms
75,592 KB
testcase_04 AC 87 ms
75,736 KB
testcase_05 AC 85 ms
75,556 KB
testcase_06 AC 82 ms
75,584 KB
testcase_07 AC 82 ms
75,644 KB
testcase_08 AC 89 ms
75,528 KB
testcase_09 AC 84 ms
75,588 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