結果
問題 |
No.75 回数の期待値の問題
|
ユーザー |
![]() |
提出日時 | 2017-01-14 23:15:44 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 60 ms / 5,000 ms |
コード長 | 764 bytes |
コンパイル時間 | 565 ms |
コンパイル使用メモリ | 76,740 KB |
実行使用メモリ | 36,480 KB |
最終ジャッジ日時 | 2024-12-21 12:56:13 |
合計ジャッジ時間 | 2,044 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) #define rrep(i, n) for (int i = (n)-1; i >= 0; i--) #define pb push_back #define all(a) (a).begin(), (a).end() #define mp make_pair using namespace std; typedef long long int lli; lli MOD = 1000000007; double pos[20010][210] = {}; int main() { pos[0][0] = 1; int k; cin >> k; rep(i, 20000) rep(j, k) { for (int l = 1; l <= 6; l++) { int a = l + j; if (a > k) a = 0; pos[i + 1][a] += 1.0 / 6.0 * pos[i][j]; } } double ans = 0; rep(i, 20000) ans += i * pos[i][k]; printf("%.10f\n", ans); }