結果

問題 No.888 約数の総和
ユーザー koukou
提出日時 2019-11-08 01:33:04
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 385 bytes
コンパイル時間 696 ms
コンパイル使用メモリ 10,928 KB
実行使用メモリ 8,636 KB
最終ジャッジ日時 2023-10-13 03:08:31
合計ジャッジ時間 2,011 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,416 KB
testcase_01 AC 18 ms
8,552 KB
testcase_02 AC 18 ms
8,548 KB
testcase_03 AC 18 ms
8,416 KB
testcase_04 AC 18 ms
8,412 KB
testcase_05 AC 19 ms
8,572 KB
testcase_06 AC 18 ms
8,548 KB
testcase_07 AC 18 ms
8,604 KB
testcase_08 AC 18 ms
8,596 KB
testcase_09 AC 18 ms
8,600 KB
testcase_10 AC 18 ms
8,468 KB
testcase_11 AC 18 ms
8,636 KB
testcase_12 AC 18 ms
8,564 KB
testcase_13 AC 18 ms
8,556 KB
testcase_14 AC 18 ms
8,608 KB
testcase_15 AC 18 ms
8,420 KB
testcase_16 AC 18 ms
8,476 KB
testcase_17 AC 18 ms
8,436 KB
testcase_18 AC 18 ms
8,472 KB
testcase_19 AC 18 ms
8,612 KB
testcase_20 AC 18 ms
8,608 KB
testcase_21 AC 18 ms
8,476 KB
testcase_22 AC 19 ms
8,576 KB
testcase_23 AC 20 ms
8,572 KB
testcase_24 AC 18 ms
8,424 KB
testcase_25 AC 18 ms
8,472 KB
testcase_26 AC 20 ms
8,432 KB
testcase_27 AC 61 ms
8,572 KB
testcase_28 AC 33 ms
8,432 KB
testcase_29 AC 19 ms
8,588 KB
testcase_30 AC 27 ms
8,600 KB
testcase_31 AC 18 ms
8,488 KB
testcase_32 AC 19 ms
8,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter

def factorization(n) -> list:
	if n == 1:
		return Counter([0])
	ret = []
	i = 2
	while i * i <= n:
		while n % i == 0:
			n //= i
			ret.append(i)
		i += 1
	if n != 1:
		ret.append(n)
	return Counter(ret)

def main():
	n=int(input())
	ans=1
	for k,v in factorization(n).items():
		ans*=(k**(v+1)-1)//(k-1)
	print(ans)

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