結果

問題 No.888 約数の総和
ユーザー O2MTO2MT
提出日時 2020-08-16 14:57:29
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 465 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 10,728 KB
実行使用メモリ 8,644 KB
最終ジャッジ日時 2023-08-01 19:16:05
合計ジャッジ時間 2,165 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,576 KB
testcase_01 AC 19 ms
8,468 KB
testcase_02 AC 18 ms
8,408 KB
testcase_03 AC 19 ms
8,572 KB
testcase_04 AC 18 ms
8,628 KB
testcase_05 AC 18 ms
8,492 KB
testcase_06 AC 18 ms
8,444 KB
testcase_07 AC 18 ms
8,460 KB
testcase_08 AC 19 ms
8,644 KB
testcase_09 AC 18 ms
8,564 KB
testcase_10 AC 19 ms
8,464 KB
testcase_11 AC 19 ms
8,404 KB
testcase_12 AC 19 ms
8,624 KB
testcase_13 AC 18 ms
8,584 KB
testcase_14 AC 18 ms
8,460 KB
testcase_15 AC 18 ms
8,592 KB
testcase_16 AC 18 ms
8,644 KB
testcase_17 AC 18 ms
8,624 KB
testcase_18 AC 18 ms
8,644 KB
testcase_19 AC 18 ms
8,636 KB
testcase_20 AC 19 ms
8,452 KB
testcase_21 AC 18 ms
8,492 KB
testcase_22 AC 18 ms
8,484 KB
testcase_23 AC 19 ms
8,624 KB
testcase_24 AC 19 ms
8,456 KB
testcase_25 AC 18 ms
8,412 KB
testcase_26 AC 19 ms
8,628 KB
testcase_27 AC 39 ms
8,584 KB
testcase_28 AC 26 ms
8,568 KB
testcase_29 AC 19 ms
8,456 KB
testcase_30 AC 22 ms
8,612 KB
testcase_31 AC 18 ms
8,448 KB
testcase_32 AC 18 ms
8,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

N = int(input())
P = Counter(prime_factorize(N))
ans = 1

for n,K in P.items():
  count = 0
  for k in range(K+1):
    count += n**k
  ans *= count
print(ans)
0