結果

問題 No.2016 Countdown Divisors
ユーザー ntudantuda
提出日時 2022-10-09 02:33:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 520 ms / 2,000 ms
コード長 561 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 10,824 KB
実行使用メモリ 7,996 KB
最終ジャッジ日時 2023-09-05 07:18:23
合計ジャッジ時間 11,290 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,988 KB
testcase_01 AC 520 ms
7,792 KB
testcase_02 AC 520 ms
7,932 KB
testcase_03 AC 475 ms
7,788 KB
testcase_04 AC 409 ms
7,828 KB
testcase_05 AC 396 ms
7,780 KB
testcase_06 AC 153 ms
7,780 KB
testcase_07 AC 152 ms
7,960 KB
testcase_08 AC 505 ms
7,972 KB
testcase_09 AC 515 ms
7,908 KB
testcase_10 AC 503 ms
7,880 KB
testcase_11 AC 517 ms
7,936 KB
testcase_12 AC 508 ms
7,824 KB
testcase_13 AC 479 ms
7,996 KB
testcase_14 AC 472 ms
7,820 KB
testcase_15 AC 467 ms
7,832 KB
testcase_16 AC 496 ms
7,796 KB
testcase_17 AC 463 ms
7,880 KB
testcase_18 AC 479 ms
7,896 KB
testcase_19 AC 16 ms
7,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def make_divisors(n):
    divisors = []  #必要に応じてsetにしても良いかも
    i = 1
    while i ** 2 <= n:
        if n % i == 0:
            divisors.append(i)
            if i ** 2 != n:
                divisors.append(n//i)
        i += 1
    divisors.sort()
    return divisors

N = 10
f = [0] * (N+1)
for i in range(1,N+1):
    dn = len(make_divisors(i))
    if i == dn:
        f[i] = i
    else:
        f[i] = f[i - dn]

T = int(input())
for _ in range(T):
    N = int(input())
    if N < 10:
        print(f[N])
    else:
        print(2)
0