結果

問題 No.1058 素敵な数
ユーザー neterukunneterukun
提出日時 2020-05-23 11:12:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 629 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 59,136 KB
最終ジャッジ日時 2024-04-16 17:19:11
合計ジャッジ時間 1,318 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
51,840 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 #

def make_divisors(n: int) -> list:
    """自然数nの約数を列挙したリストを出力する
    計算量: O(sqrt(N))
    入出力例: 12 -> [1, 2, 3, 4, 6, 12]
    """
    divisors = []
    for k in range(1, int(n ** 0.5) + 1):
        if n % k == 0:
            divisors.append(k)
            if k != n // k: 
                divisors.append(n // k)
    divisors = sorted(divisors)
    return divisors


n = int(input())
if n == 1:
    print(1)
    exit()
n -= 1

ans = 10 ** 5 + 1
while True:
    v = make_divisors(ans)
    if len(v) == 2:
        n -= 1
    if n == 0:
        print(ans)
        exit()
    ans += 1
0