結果

問題 No.567 コンプリート
ユーザー okchan08okchan08
提出日時 2018-04-05 21:48:44
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 563 ms / 2,000 ms
コード長 528 bytes
コンパイル時間 533 ms
コンパイル使用メモリ 68,860 KB
実行使用メモリ 88,880 KB
最終ジャッジ日時 2023-09-08 17:51:05
合計ジャッジ時間 1,904 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <iomanip>

using namespace std;

int main(){
    int N; cin >> N;

    vector<vector<double> > dp(N+1,vector<double>(7,0.0));
    // dp[i][j] i回投げて,j種類の面が出ている確率
    dp[0][0] = 1.0;

    for(int i=0;i<N;i++){
        for(int j=0;j<=6;j++){
            dp[i+1][j+1] += dp[i][j] * (double)(6-j)/6.0;
            dp[i+1][j] += dp[i][j] * (double)j/6.0;
        }
    }
    cout << fixed << setprecision(15);
    cout << dp[N][6] << endl;
    return 0;
}
0