結果
問題 |
No.65 回数の期待値の練習
|
ユーザー |
|
提出日時 | 2022-09-28 16:06:28 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 50 ms / 5,000 ms |
コード長 | 414 bytes |
コンパイル時間 | 1,975 ms |
コンパイル使用メモリ | 193,632 KB |
最終ジャッジ日時 | 2025-02-07 17:53:51 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); int K; cin >> K; vector<double> E(K + 1, 1); for(int x = K; x >= 1; x--) { for(int y = 1; y <= 6; y++) if(x + y <= K) E[x] += E[x + y] / 6.0; } cout << fixed << setprecision(20) << E[1] << endl; }