結果

問題 No.2645 Sum of Divisors?
ユーザー pockynypockyny
提出日時 2024-02-25 05:38:20
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 105 ms / 2,000 ms
コード長 620 bytes
コンパイル時間 788 ms
コンパイル使用メモリ 79,220 KB
実行使用メモリ 19,420 KB
最終ジャッジ日時 2024-02-25 05:38:23
合計ジャッジ時間 2,885 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
19,164 KB
testcase_01 AC 8 ms
19,164 KB
testcase_02 AC 56 ms
19,420 KB
testcase_03 AC 8 ms
19,164 KB
testcase_04 AC 7 ms
19,164 KB
testcase_05 AC 7 ms
19,164 KB
testcase_06 AC 105 ms
19,420 KB
testcase_07 AC 105 ms
19,420 KB
testcase_08 AC 8 ms
19,164 KB
testcase_09 AC 8 ms
19,164 KB
testcase_10 AC 8 ms
19,164 KB
testcase_11 AC 8 ms
19,164 KB
testcase_12 AC 8 ms
19,164 KB
testcase_13 AC 8 ms
19,164 KB
testcase_14 AC 8 ms
19,164 KB
testcase_15 AC 8 ms
19,164 KB
testcase_16 AC 7 ms
19,164 KB
testcase_17 AC 8 ms
19,164 KB
testcase_18 AC 8 ms
19,420 KB
testcase_19 AC 9 ms
19,420 KB
testcase_20 AC 9 ms
19,420 KB
testcase_21 AC 9 ms
19,420 KB
testcase_22 AC 8 ms
19,420 KB
testcase_23 AC 9 ms
19,420 KB
testcase_24 AC 15 ms
19,420 KB
testcase_25 AC 13 ms
19,420 KB
testcase_26 AC 17 ms
19,420 KB
testcase_27 AC 20 ms
19,420 KB
testcase_28 AC 36 ms
19,420 KB
testcase_29 AC 102 ms
19,420 KB
testcase_30 AC 39 ms
19,420 KB
testcase_31 AC 59 ms
19,420 KB
testcase_32 AC 81 ms
19,420 KB
testcase_33 AC 42 ms
19,420 KB
testcase_34 AC 75 ms
19,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>

using namespace std;
typedef long long ll;
typedef long double ld;
ld h[1000010];
const ld eu = 0.5772156649;
ld H(ll n){
    if(n<=1000000) return h[n];
    return log(n) + eu + (ld)1/(ld)2/(ld)n - (ld)1/(ld)12/(ld)n/(ld)n + (ld)1/(ld)120/(ld)n/(ld)n/(ld)n/(ld)n;
}

int main(){
    cout.precision(20);
    for(int i=1;i<=1000000;i++){
        h[i] = h[i - 1] + (ld)1/(ld)i;
    }
    ll n; cin >> n;
    ld ans = 0;
    for(ll l = 1;l<=n;){
        ll r = n/(n/l);
        if(l>r) break;
        ans += (H(r) - H(l - 1))*H(n/l);
        l = r + 1;
    }
    cout << ans << "\n";
}
0