結果

問題 No.1271 初めての級数
ユーザー Inazuma_110Inazuma_110
提出日時 2020-10-30 21:27:23
言語 C++17
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 860 bytes
コンパイル時間 5,028 ms
使用メモリ 9,768 KB
最終ジャッジ日時 2023-02-21 10:46:07
合計ジャッジ時間 5,878 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 5 ms
7,612 KB
testcase_01 AC 5 ms
7,604 KB
testcase_02 AC 5 ms
7,680 KB
testcase_03 AC 5 ms
9,756 KB
testcase_04 AC 5 ms
7,652 KB
testcase_05 AC 5 ms
7,564 KB
testcase_06 AC 5 ms
7,668 KB
testcase_07 AC 5 ms
7,680 KB
testcase_08 AC 5 ms
7,568 KB
testcase_09 AC 6 ms
9,768 KB
testcase_10 AC 5 ms
9,752 KB
testcase_11 AC 6 ms
7,572 KB
testcase_12 AC 5 ms
9,692 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
// #include <atcoder/all>

using boost::multiprecision::cpp_int;
using namespace std;
// using namespace atcoder;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

typedef long long ll;
typedef pair<ll, ll> p;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  long double k;
  cin >> k;
  long double res = 0;
  for (int i = 1; i < 2e6; ++i) {
    res += 1.0/(i*(i+k));
  }
  cout << setprecision(15);
  cout << res << endl;
}
0