結果

問題 No.1271 初めての級数
ユーザー oooooba
提出日時 2021-07-01 22:27:36
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 513 bytes
コンパイル時間 1,000 ms
コンパイル使用メモリ 111,032 KB
最終ジャッジ日時 2025-01-22 15:26:35
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <optional>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

int main() {
    int32_t k;
    cin >> k;
    double ans = 0;
    for (auto i = int64_t(1000 * 1000 * 10); i > 0; --i) {
        ans += 1.0 / (i * (i + k));
    }
    printf("%.9f\n", ans);
    return 0;
}
0