結果

問題 No.1271 初めての級数
ユーザー yansi819yansi819
提出日時 2024-03-23 20:27:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 360 bytes
コンパイル時間 4,404 ms
コンパイル使用メモリ 262,268 KB
実行使用メモリ 16,808 KB
最終ジャッジ日時 2024-03-23 20:28:03
合計ジャッジ時間 11,020 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_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