結果

問題 No.1271 初めての級数
ユーザー yansi819
提出日時 2024-03-23 20:27:52
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 360 bytes
コンパイル時間 3,348 ms
コンパイル使用メモリ 250,748 KB
最終ジャッジ日時 2025-02-20 13:28:41
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other TLE * 1 -- * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ld = long double;

int k;
ll n = 1;
ld ans = 0, ans1 = -1;

int main() {
  cin >> k;
  while (ans != ans1) {
    ans1 = ans;
    ans += (ld)1 / (n * (n + k)); 
    n++;
  }
  cout << fixed << setprecision(15) << ans << endl;
  return 0;
}
0