結果

問題 No.2645 Sum of Divisors?
ユーザー kotatsugamekotatsugame
提出日時 2024-02-24 06:59:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 178 ms / 2,000 ms
コード長 562 bytes
コンパイル時間 921 ms
コンパイル使用メモリ 74,536 KB
実行使用メモリ 160,112 KB
最終ジャッジ日時 2024-02-24 06:59:40
合計ジャッジ時間 5,823 ms
ジャッジサーバーID
(参考情報)
judge16 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
159,984 KB
testcase_01 AC 62 ms
159,984 KB
testcase_02 AC 113 ms
160,112 KB
testcase_03 AC 62 ms
159,984 KB
testcase_04 AC 62 ms
159,984 KB
testcase_05 AC 62 ms
159,984 KB
testcase_06 AC 178 ms
160,112 KB
testcase_07 AC 152 ms
160,112 KB
testcase_08 AC 61 ms
159,984 KB
testcase_09 AC 62 ms
159,984 KB
testcase_10 AC 63 ms
159,984 KB
testcase_11 AC 62 ms
159,984 KB
testcase_12 AC 62 ms
159,984 KB
testcase_13 AC 62 ms
159,984 KB
testcase_14 AC 62 ms
159,984 KB
testcase_15 AC 62 ms
159,984 KB
testcase_16 AC 62 ms
159,984 KB
testcase_17 AC 63 ms
159,984 KB
testcase_18 AC 63 ms
159,984 KB
testcase_19 AC 62 ms
159,984 KB
testcase_20 AC 65 ms
160,112 KB
testcase_21 AC 63 ms
160,112 KB
testcase_22 AC 63 ms
160,112 KB
testcase_23 AC 64 ms
160,112 KB
testcase_24 AC 70 ms
160,112 KB
testcase_25 AC 70 ms
160,112 KB
testcase_26 AC 73 ms
160,112 KB
testcase_27 AC 76 ms
160,112 KB
testcase_28 AC 94 ms
160,112 KB
testcase_29 AC 150 ms
160,112 KB
testcase_30 AC 97 ms
160,112 KB
testcase_31 AC 114 ms
160,112 KB
testcase_32 AC 140 ms
160,112 KB
testcase_33 AC 99 ms
160,112 KB
testcase_34 AC 129 ms
160,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<iomanip>
#include<cmath>
#include<cassert>
using namespace std;
const int LIM=(int)1e7+1;
long double H[LIM];
long double calc(long long x)
{
	if(x<LIM)return H[x];
	return log((long double)x)+0.5772156649+0.5/x;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	for(int i=1;i<LIM;i++)H[i]=H[i-1]+(long double)1/i;
	long long N;cin>>N;
	long long l=1;
	long double ans=0;
	while(l<=N)
	{
		long long q=N/l;
		long long r=N/q;
		ans+=(calc(r)-calc(l-1))*calc(q);
		l=r+1;
	}
	cout<<fixed<<setprecision(16)<<ans<<endl;
}
0