結果

問題 No.2645 Sum of Divisors?
ユーザー rikein12rikein12
提出日時 2024-02-20 01:16:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 450 bytes
コンパイル時間 615 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 91,520 KB
最終ジャッジ日時 2024-02-20 01:16:17
合計ジャッジ時間 4,312 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
75,804 KB
testcase_01 AC 52 ms
75,804 KB
testcase_02 AC 94 ms
91,492 KB
testcase_03 AC 49 ms
75,548 KB
testcase_04 AC 54 ms
75,804 KB
testcase_05 AC 52 ms
75,804 KB
testcase_06 AC 115 ms
91,332 KB
testcase_07 AC 112 ms
91,332 KB
testcase_08 AC 52 ms
75,804 KB
testcase_09 AC 49 ms
75,804 KB
testcase_10 AC 50 ms
75,804 KB
testcase_11 AC 50 ms
75,804 KB
testcase_12 AC 49 ms
75,804 KB
testcase_13 AC 48 ms
75,804 KB
testcase_14 AC 49 ms
75,804 KB
testcase_15 AC 48 ms
75,804 KB
testcase_16 AC 51 ms
75,804 KB
testcase_17 AC 50 ms
75,804 KB
testcase_18 AC 54 ms
78,288 KB
testcase_19 AC 55 ms
78,288 KB
testcase_20 AC 62 ms
78,288 KB
testcase_21 AC 55 ms
78,288 KB
testcase_22 AC 55 ms
78,284 KB
testcase_23 AC 57 ms
80,948 KB
testcase_24 AC 72 ms
87,688 KB
testcase_25 AC 69 ms
86,876 KB
testcase_26 AC 75 ms
90,668 KB
testcase_27 AC 73 ms
86,668 KB
testcase_28 AC 83 ms
91,520 KB
testcase_29 AC 115 ms
91,332 KB
testcase_30 AC 85 ms
91,520 KB
testcase_31 AC 93 ms
91,484 KB
testcase_32 AC 104 ms
91,476 KB
testcase_33 AC 95 ms
91,520 KB
testcase_34 AC 102 ms
91,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

N = int(input())

def zeta(x):
    return 1/x

zeta_c = [0] * (10**6 + 1)
for i in range(1,10**6 + 1):
    zeta_c[i] = zeta_c[i-1] + 1/i
def zeta_cumsum(x):
    if x <= 10**6:
        return zeta_c[x]
    else:
        return math.log(x) + 0.5772156649

M = int(N ** 0.5)

ans = 0
for i in range(1, M+1):
    ans += zeta_cumsum(N//i) * zeta(i)

for j in range(1, M+1):
    ans += (zeta_cumsum(N//j) - zeta_cumsum(M))* zeta(j)

print(ans)
0