結果

問題 No.75 回数の期待値の問題
ユーザー uenokuuenoku
提出日時 2017-01-14 23:14:21
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 761 bytes
コンパイル時間 688 ms
コンパイル使用メモリ 75,932 KB
実行使用メモリ 5,324 KB
最終ジャッジ日時 2023-08-23 10:47:10
合計ジャッジ時間 1,912 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
5,264 KB
testcase_01 AC 4 ms
5,088 KB
testcase_02 AC 4 ms
5,248 KB
testcase_03 AC 4 ms
5,252 KB
testcase_04 AC 4 ms
5,092 KB
testcase_05 AC 4 ms
5,188 KB
testcase_06 AC 4 ms
5,152 KB
testcase_07 AC 4 ms
5,300 KB
testcase_08 AC 4 ms
5,088 KB
testcase_09 AC 4 ms
5,124 KB
testcase_10 AC 4 ms
5,188 KB
testcase_11 AC 4 ms
5,092 KB
testcase_12 AC 4 ms
5,192 KB
testcase_13 AC 4 ms
5,124 KB
testcase_14 AC 4 ms
5,264 KB
testcase_15 AC 4 ms
5,324 KB
testcase_16 AC 4 ms
5,316 KB
testcase_17 AC 5 ms
5,268 KB
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[1000][210] = {};
int main()
{
    pos[0][0] = 1;
    int k;
    cin >> k;
    rep(i, 1000) 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, 1000) ans += i * pos[i][k];
    printf("%.10f\n", ans);
}
0