結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,548 KB
testcase_01 AC 20 ms
8,752 KB
testcase_02 AC 20 ms
8,568 KB
testcase_03 AC 21 ms
8,620 KB
testcase_04 AC 21 ms
8,728 KB
testcase_05 AC 19 ms
8,744 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 19 ms
8,664 KB
testcase_10 AC 20 ms
8,572 KB
testcase_11 AC 20 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 20 ms
8,588 KB
testcase_19 AC 23 ms
8,596 KB
testcase_20 AC 145 ms
8,544 KB
testcase_21 AC 20 ms
8,592 KB
testcase_22 AC 19 ms
8,572 KB
testcase_23 AC 20 ms
8,736 KB
testcase_24 AC 20 ms
8,756 KB
testcase_25 AC 20 ms
8,588 KB
testcase_26 AC 20 ms
8,720 KB
testcase_27 AC 19 ms
8,584 KB
testcase_28 AC 20 ms
8,732 KB
testcase_29 AC 19 ms
8,616 KB
testcase_30 AC 19 ms
8,672 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())
    if N == 1:
        print(1)
        return
    if N == 2:
        print(2)
        return 
        
    divisors = calc_positive_divisors(N)
    divisors_num = reduce(mul, map(lambda num: num + 1, divisors.values()))

    print(divisors_num)


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