結果

問題 No.1271 初めての級数
ユーザー KY2001KY2001
提出日時 2020-10-30 22:14:24
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,440 bytes
コンパイル時間 2,023 ms
コンパイル使用メモリ 199,740 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-29 06:29:15
合計ジャッジ時間 3,065 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,380 KB
testcase_01 AC 3 ms
4,380 KB
testcase_02 AC 3 ms
4,384 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 3 ms
4,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 3 ms
4,376 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 3 ms
4,376 KB
testcase_11 AC 3 ms
4,380 KB
testcase_12 AC 3 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)            // [0, b)
#define rep2(i, a, b) for (int i = (int)(a); i < (int)(b); i++) // [a, b)
#define rep3(i, a, b)                                           // reversed [a, b] so [b, b-1, ... a]
#define FOR(i, a) for (auto &i: a)
#define ALL(obj) begin(obj), end(obj)
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define SUM(x) accumulate(ALL(x), 0LL)
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))

using namespace std;
const int MOD    = (int)(1e18 + 7);
const int INF    = (int)(1e13 + 7);
const double EPS = 1e-14;
const double PI  = acos(-1);

int CEIL(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); } //ceil() for int
int mod(int a, int b) { return a >= 0 ? a % b : a - (b * CEIL(a, b)); }             //always return positive num
int pow_mod(int a, int b) {                                                         //return x^y in order(log(y))
  int res = 1;
  for (a %= MOD; b; a = a * a % MOD, b >>= 1)
    if (b & 1) res = res * a % MOD;
  return res;
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int k;
  cin >> k;
  double ans = 0;
  rep2(i, 1, 1000000) {
    ans += 1 / (double)(i * (i + k));
  }
  cout << fixed << setprecision(10) << ans << endl;
}
0