結果
| 問題 |
No.2645 Sum of Divisors?
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-02-19 23:03:18 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 59 ms / 2,000 ms |
| コード長 | 714 bytes |
| コンパイル時間 | 2,664 ms |
| コンパイル使用メモリ | 246,680 KB |
| 実行使用メモリ | 19,304 KB |
| 最終ジャッジ日時 | 2024-09-29 02:45:37 |
| 合計ジャッジ時間 | 4,555 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
// #pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
// #include <x86intrin.h>
using namespace std;
#if __cplusplus >= 202002L
using namespace numbers;
#endif
int main(){
cin.tie(0)->sync_with_stdio(0);
cin.exceptions(ios::badbit | ios::failbit);
cout << fixed << setprecision(15);
long long n;
cin >> n;
const int m = 1e6;
vector<long double> h(m + 1);
for(auto i = 1; i <= m; ++ i){
h[i] = h[i - 1] + 1.0L / i;
}
auto eval = [&](long long x)->long double{
return x <= m ? h[x] : logl(x) + egamma_v<long double>;
};
long double res = 0;
for(auto x = 1; x <= m; ++ x){
res += (2 * eval(n / x) - eval(min<long long>(m, n / x))) / x;
}
cout << res << "\n";
return 0;
}
/*
*/