結果
| 問題 | No.2645 Sum of Divisors? |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-02-24 06:59:34 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 159 ms / 2,000 ms |
| コード長 | 562 bytes |
| コンパイル時間 | 606 ms |
| コンパイル使用メモリ | 75,312 KB |
| 実行使用メモリ | 160,192 KB |
| 最終ジャッジ日時 | 2024-09-29 09:53:12 |
| 合計ジャッジ時間 | 5,077 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
#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;
}