結果

問題 No.2645 Sum of Divisors?
ユーザー AerenAeren
提出日時 2024-02-19 23:03:18
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 714 bytes
コンパイル時間 2,812 ms
コンパイル使用メモリ 246,704 KB
実行使用メモリ 19,196 KB
最終ジャッジ日時 2024-02-19 23:03:23
合計ジャッジ時間 4,623 ms
ジャッジサーバーID
(参考情報)
judge15 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
19,068 KB
testcase_01 AC 21 ms
19,068 KB
testcase_02 AC 32 ms
19,196 KB
testcase_03 AC 21 ms
19,068 KB
testcase_04 AC 21 ms
19,068 KB
testcase_05 AC 21 ms
19,068 KB
testcase_06 AC 54 ms
19,196 KB
testcase_07 AC 54 ms
19,196 KB
testcase_08 AC 21 ms
19,068 KB
testcase_09 AC 22 ms
19,068 KB
testcase_10 AC 21 ms
19,068 KB
testcase_11 AC 21 ms
19,068 KB
testcase_12 AC 21 ms
19,068 KB
testcase_13 AC 21 ms
19,068 KB
testcase_14 AC 21 ms
19,068 KB
testcase_15 AC 22 ms
19,068 KB
testcase_16 AC 22 ms
19,068 KB
testcase_17 AC 21 ms
19,068 KB
testcase_18 AC 21 ms
19,196 KB
testcase_19 AC 21 ms
19,196 KB
testcase_20 AC 22 ms
19,196 KB
testcase_21 AC 21 ms
19,196 KB
testcase_22 AC 22 ms
19,196 KB
testcase_23 AC 23 ms
19,196 KB
testcase_24 AC 21 ms
19,196 KB
testcase_25 AC 21 ms
19,196 KB
testcase_26 AC 22 ms
19,196 KB
testcase_27 AC 22 ms
19,196 KB
testcase_28 AC 28 ms
19,196 KB
testcase_29 AC 55 ms
19,196 KB
testcase_30 AC 27 ms
19,196 KB
testcase_31 AC 34 ms
19,196 KB
testcase_32 AC 46 ms
19,196 KB
testcase_33 AC 28 ms
19,196 KB
testcase_34 AC 40 ms
19,196 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// #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;
}

/*

*/
0