結果

問題 No.537 ユーザーID
ユーザー ThetaTheta
提出日時 2022-10-24 18:43:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 785 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 10,956 KB
実行使用メモリ 8,772 KB
最終ジャッジ日時 2023-09-15 20:10:37
合計ジャッジ時間 2,567 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,584 KB
testcase_01 AC 20 ms
8,536 KB
testcase_02 AC 20 ms
8,584 KB
testcase_03 AC 20 ms
8,748 KB
testcase_04 AC 19 ms
8,752 KB
testcase_05 AC 19 ms
8,540 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 RE -
testcase_10 AC 19 ms
8,540 KB
testcase_11 AC 19 ms
8,572 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 19 ms
8,676 KB
testcase_19 AC 23 ms
8,664 KB
testcase_20 AC 146 ms
8,584 KB
testcase_21 AC 20 ms
8,728 KB
testcase_22 AC 19 ms
8,576 KB
testcase_23 AC 20 ms
8,600 KB
testcase_24 AC 20 ms
8,580 KB
testcase_25 AC 19 ms
8,580 KB
testcase_26 AC 20 ms
8,732 KB
testcase_27 AC 19 ms
8,608 KB
testcase_28 AC 19 ms
8,740 KB
testcase_29 AC 20 ms
8,740 KB
testcase_30 AC 20 ms
8,740 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import reduce
from itertools import accumulate, count
from operator import mul


def calc_positive_divisors(num: int) -> dict[int, int]:
    if num < 2:
        raise ValueError

    divisors = {}
    for divisor in count(2):
        if divisor ** 2 > num:
            if num != 1:
                divisors[num] = 1
            break
        while num % divisor == 0 and num != 1:
            try:
                divisors[divisor] += 1
            except KeyError:
                divisors[divisor] = 1
            num //= divisor

    return divisors


def main():
    N = int(input())
    divisors = calc_positive_divisors(N)
    divisors_num = reduce(mul, map(lambda num: num + 1, divisors.values()))

    print(divisors_num)


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