結果

問題 No.2645 Sum of Divisors?
ユーザー shobonvipshobonvip
提出日時 2024-02-11 11:17:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 173 ms / 2,000 ms
コード長 377 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 91,380 KB
最終ジャッジ日時 2024-02-12 13:29:53
合計ジャッジ時間 4,178 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
75,428 KB
testcase_01 AC 56 ms
77,900 KB
testcase_02 AC 123 ms
91,380 KB
testcase_03 AC 51 ms
75,432 KB
testcase_04 AC 51 ms
75,432 KB
testcase_05 AC 51 ms
75,432 KB
testcase_06 AC 173 ms
91,372 KB
testcase_07 AC 173 ms
91,372 KB
testcase_08 AC 51 ms
75,432 KB
testcase_09 AC 52 ms
75,432 KB
testcase_10 AC 51 ms
75,432 KB
testcase_11 AC 53 ms
75,432 KB
testcase_12 AC 52 ms
75,432 KB
testcase_13 AC 52 ms
75,432 KB
testcase_14 AC 54 ms
75,560 KB
testcase_15 AC 52 ms
75,432 KB
testcase_16 AC 56 ms
77,900 KB
testcase_17 AC 56 ms
77,900 KB
testcase_18 AC 56 ms
78,156 KB
testcase_19 AC 56 ms
78,152 KB
testcase_20 AC 57 ms
78,152 KB
testcase_21 AC 56 ms
78,152 KB
testcase_22 AC 57 ms
78,152 KB
testcase_23 AC 64 ms
80,356 KB
testcase_24 AC 72 ms
84,476 KB
testcase_25 AC 69 ms
82,420 KB
testcase_26 AC 75 ms
84,468 KB
testcase_27 AC 78 ms
84,468 KB
testcase_28 AC 104 ms
91,380 KB
testcase_29 AC 171 ms
91,372 KB
testcase_30 AC 107 ms
91,380 KB
testcase_31 AC 127 ms
91,380 KB
testcase_32 AC 150 ms
91,372 KB
testcase_33 AC 108 ms
91,380 KB
testcase_34 AC 143 ms
91,372 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 + 1 / (2 * n)

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