結果
問題 |
No.65 回数の期待値の練習
|
ユーザー |
![]() |
提出日時 | 2023-10-14 20:24:20 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 512 bytes |
コンパイル時間 | 902 ms |
コンパイル使用メモリ | 104,416 KB |
最終ジャッジ日時 | 2025-02-17 07:49:32 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
#include<iostream> #include<iomanip> #include<string> #include<algorithm> #include<vector> #include<set> #include<list> #include<queue> #include<math.h> #include<bitset> using ll = long long; using namespace std; int main(){ int k; double anst = 0; cin >> k; vector<double> dice(k+1); dice[1] = 1.0; for (int i = 2; i <= k; i++){ for (int l = 1; l <= 6; l++){ if (i - l >= 0) dice[i] += dice[i-l]/6; } dice[i]++; } cout << dice[k] << endl; }