結果
問題 | No.1271 初めての級数 |
ユーザー |
|
提出日時 | 2024-08-11 15:27:54 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 328 bytes |
コンパイル時間 | 2,605 ms |
コンパイル使用メモリ | 243,444 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-08-11 15:27:58 |
合計ジャッジ時間 | 3,432 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 13 |
ソースコード
// #define _GLIBCXX_DEBUG#include<bits/stdc++.h>using namespace std;int k;int main(){ios::sync_with_stdio(false);std::cin.tie(nullptr);cout<<fixed<<setprecision(15);cin>>k;if(k==0){cout<<M_PI*M_PI/6<<endl;return 0;}double ans=0;for(int i=1;i<=k;i++){ans+=1/(double)i;}cout<<ans/k<<endl;}