結果

問題 No.75 回数の期待値の問題
ユーザー uenokuuenoku
提出日時 2017-01-14 23:14:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 764 bytes
コンパイル時間 666 ms
コンパイル使用メモリ 76,536 KB
実行使用メモリ 20,068 KB
最終ジャッジ日時 2023-08-23 10:47:18
合計ジャッジ時間 3,177 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
19,944 KB
testcase_01 AC 23 ms
19,944 KB
testcase_02 AC 19 ms
19,956 KB
testcase_03 AC 20 ms
19,896 KB
testcase_04 AC 20 ms
19,848 KB
testcase_05 AC 18 ms
19,864 KB
testcase_06 AC 20 ms
20,000 KB
testcase_07 AC 20 ms
19,844 KB
testcase_08 AC 20 ms
19,852 KB
testcase_09 AC 20 ms
19,876 KB
testcase_10 AC 20 ms
20,064 KB
testcase_11 AC 21 ms
19,848 KB
testcase_12 AC 21 ms
19,908 KB
testcase_13 AC 21 ms
19,900 KB
testcase_14 AC 20 ms
20,068 KB
testcase_15 AC 20 ms
19,844 KB
testcase_16 AC 24 ms
19,860 KB
testcase_17 AC 30 ms
19,956 KB
testcase_18 RE -
testcase_19 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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[10000][210] = {};
int main()
{
    pos[0][0] = 1;
    int k;
    cin >> k;
    rep(i, 10000) 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, 10000) ans += i * pos[i][k];
    printf("%.10f\n", ans);
}
0