結果
問題 | No.1271 初めての級数 |
ユーザー |
![]() |
提出日時 | 2023-08-29 17:13:16 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 421 bytes |
コンパイル時間 | 1,122 ms |
コンパイル使用メモリ | 100,268 KB |
最終ジャッジ日時 | 2025-02-16 15:33:14 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 13 |
ソースコード
#include<iostream> #include<map> #include<vector> #include <algorithm> #include<math.h> #include <iomanip> #include<set> #include <numeric> #include<string> using namespace std; int main() { int k; cin >> k; double sum1 = 0; for (int i = 1; i <= k; i++){ sum1 += 1./i; } cout << fixed << setprecision(8); if (k == 0) cout << M_PI*M_PI/6 << endl; else cout << sum1/k << endl; }