結果

問題 No.75 回数の期待値の問題
ユーザー uenokuuenoku
提出日時 2017-01-14 23:13:47
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 758 bytes
コンパイル時間 623 ms
コンパイル使用メモリ 76,360 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-23 10:46:41
合計ジャッジ時間 1,843 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 3 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 3 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

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