結果

問題 No.1033 乱数サイ
ユーザー ricoriser32
提出日時 2020-04-24 21:29:20
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 520 bytes
コンパイル時間 2,152 ms
コンパイル使用メモリ 191,424 KB
最終ジャッジ日時 2025-01-09 23:12:38
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n,k;
  cin >> n >> k;
  ll total = (n+1)*k;
  ld ans = 0.0;
  for(ll i=0; i<n+1; i++){
    ans += ld(i*k)/total;
  }
  cout << fixed << setprecision(9) << ans << '\n';
  return 0;
}
0