結果

問題 No.888 約数の総和
ユーザー brthyyjpbrthyyjp
提出日時 2020-03-13 18:26:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 90 ms / 2,000 ms
コード長 479 bytes
コンパイル時間 415 ms
コンパイル使用メモリ 86,664 KB
実行使用メモリ 75,496 KB
最終ジャッジ日時 2023-08-14 14:27:28
合計ジャッジ時間 4,386 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,084 KB
testcase_01 AC 71 ms
71,100 KB
testcase_02 AC 74 ms
70,876 KB
testcase_03 AC 74 ms
71,204 KB
testcase_04 AC 70 ms
71,084 KB
testcase_05 AC 72 ms
71,084 KB
testcase_06 AC 69 ms
71,144 KB
testcase_07 AC 71 ms
71,028 KB
testcase_08 AC 75 ms
71,036 KB
testcase_09 AC 75 ms
71,032 KB
testcase_10 AC 73 ms
71,228 KB
testcase_11 AC 71 ms
71,208 KB
testcase_12 AC 72 ms
71,368 KB
testcase_13 AC 74 ms
71,256 KB
testcase_14 AC 73 ms
70,880 KB
testcase_15 AC 71 ms
71,244 KB
testcase_16 AC 72 ms
71,456 KB
testcase_17 AC 70 ms
71,212 KB
testcase_18 AC 88 ms
75,324 KB
testcase_19 AC 87 ms
75,384 KB
testcase_20 AC 82 ms
75,264 KB
testcase_21 AC 89 ms
75,292 KB
testcase_22 AC 90 ms
75,104 KB
testcase_23 AC 75 ms
75,108 KB
testcase_24 AC 80 ms
74,972 KB
testcase_25 AC 82 ms
75,416 KB
testcase_26 AC 82 ms
75,332 KB
testcase_27 AC 83 ms
75,132 KB
testcase_28 AC 86 ms
75,332 KB
testcase_29 AC 88 ms
75,108 KB
testcase_30 AC 88 ms
75,256 KB
testcase_31 AC 88 ms
75,496 KB
testcase_32 AC 89 ms
75,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

def div(n):
  d = {}
  temp = int(math.sqrt(n))+1
  for i in range(2, temp):
    while n%i== 0:
      n //= i
      if i in d:
        d[i] += 1
      else:
        d[i] = 1
  if d == {}:
    d[n] = 1
  else:
    if n in d:
      d[n] += 1
    elif n != 1:
      d[n] = 1
  return d

n = int(input())
d = div(n)
ans = 1

if n == 1:
    print(1)
    exit()

for k, v in d.items():
    temp = 0
    for i in range(v+1):
        temp += k**i
    ans *= temp
print(ans)
0