結果

問題 No.2645 Sum of Divisors?
ユーザー shobonvipshobonvip
提出日時 2024-02-19 06:31:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 184 ms / 2,000 ms
コード長 363 bytes
コンパイル時間 477 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 91,380 KB
最終ジャッジ日時 2024-02-19 06:31:19
合計ジャッジ時間 5,085 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
75,560 KB
testcase_01 AC 61 ms
78,036 KB
testcase_02 AC 136 ms
91,380 KB
testcase_03 AC 52 ms
75,560 KB
testcase_04 AC 53 ms
75,552 KB
testcase_05 AC 53 ms
75,560 KB
testcase_06 AC 166 ms
91,368 KB
testcase_07 AC 184 ms
91,368 KB
testcase_08 AC 53 ms
75,560 KB
testcase_09 AC 52 ms
75,560 KB
testcase_10 AC 51 ms
75,560 KB
testcase_11 AC 51 ms
75,560 KB
testcase_12 AC 52 ms
75,560 KB
testcase_13 AC 54 ms
75,560 KB
testcase_14 AC 56 ms
75,560 KB
testcase_15 AC 53 ms
75,560 KB
testcase_16 AC 57 ms
78,036 KB
testcase_17 AC 56 ms
78,036 KB
testcase_18 AC 56 ms
78,164 KB
testcase_19 AC 57 ms
78,164 KB
testcase_20 AC 58 ms
78,156 KB
testcase_21 AC 58 ms
78,156 KB
testcase_22 AC 68 ms
78,156 KB
testcase_23 AC 65 ms
80,352 KB
testcase_24 AC 72 ms
82,420 KB
testcase_25 AC 69 ms
82,420 KB
testcase_26 AC 76 ms
84,468 KB
testcase_27 AC 78 ms
84,468 KB
testcase_28 AC 115 ms
91,380 KB
testcase_29 AC 167 ms
91,368 KB
testcase_30 AC 105 ms
91,380 KB
testcase_31 AC 124 ms
91,380 KB
testcase_32 AC 172 ms
91,368 KB
testcase_33 AC 107 ms
91,380 KB
testcase_34 AC 140 ms
91,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
gamma = .5772156649015328606065120
mx = 1000000

H_table = [0] * (mx + 1)

def H(n):
	if n < 0: return 0.0
	if n <= mx: return H_table[n]
	return math.log(n) + gamma

for i in range(1, mx+1):
	H_table[i] = H_table[i-1] + 1 / i

n = int(input())
ans = 0.0
i = n
while i > 0:
	v = n // i
	j = n // (v + 1)
	ans += H(v) * (H(i) - H(j))
	i = j

print(ans)
0