結果

問題 No.888 約数の総和
ユーザー ThetaTheta
提出日時 2022-11-25 14:00:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 555 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 82,448 KB
実行使用メモリ 59,916 KB
最終ジャッジ日時 2024-04-09 21:40:14
合計ジャッジ時間 2,474 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,540 KB
testcase_01 AC 37 ms
52,456 KB
testcase_02 AC 38 ms
52,460 KB
testcase_03 AC 35 ms
53,480 KB
testcase_04 AC 35 ms
53,024 KB
testcase_05 AC 36 ms
52,012 KB
testcase_06 AC 37 ms
53,524 KB
testcase_07 AC 36 ms
53,636 KB
testcase_08 AC 37 ms
53,012 KB
testcase_09 AC 37 ms
52,476 KB
testcase_10 AC 36 ms
53,208 KB
testcase_11 AC 35 ms
52,568 KB
testcase_12 AC 33 ms
53,148 KB
testcase_13 AC 37 ms
52,008 KB
testcase_14 AC 35 ms
53,012 KB
testcase_15 AC 36 ms
53,736 KB
testcase_16 AC 35 ms
52,004 KB
testcase_17 AC 36 ms
52,852 KB
testcase_18 AC 52 ms
57,928 KB
testcase_19 AC 47 ms
58,928 KB
testcase_20 AC 45 ms
57,384 KB
testcase_21 AC 52 ms
59,916 KB
testcase_22 AC 50 ms
59,196 KB
testcase_23 AC 36 ms
57,752 KB
testcase_24 AC 42 ms
59,268 KB
testcase_25 AC 43 ms
58,528 KB
testcase_26 AC 46 ms
58,136 KB
testcase_27 AC 48 ms
58,072 KB
testcase_28 AC 47 ms
57,812 KB
testcase_29 AC 46 ms
57,328 KB
testcase_30 AC 48 ms
58,164 KB
testcase_31 AC 48 ms
58,152 KB
testcase_32 AC 51 ms
59,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt, floor


def calc_positive_divisors(num: int) -> list[int]:
    small_divisors = []
    large_divisors = []
    for n in range(1, floor(sqrt(num))+1):
        if num % n == 0:
            small_divisors.append(n)
            large_divisors.append(num//n)
    if small_divisors[-1] == large_divisors[-1]:
        large_divisors.pop()
    divisors = small_divisors + list(reversed(large_divisors))
    return divisors


def main():
    N = int(input())
    print(sum(calc_positive_divisors(N)))


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