結果

問題 No.567 コンプリート
ユーザー teketeke5000teketeke5000
提出日時 2017-09-14 01:05:30
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 389 ms / 2,000 ms
コード長 396 bytes
コンパイル時間 2,554 ms
コンパイル使用メモリ 157,684 KB
実行使用メモリ 58,112 KB
最終ジャッジ日時 2024-04-25 10:26:30
合計ジャッジ時間 2,414 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(void) {
    ll N;
    cin >> N;
    double dp[N+1][7];
    dp[1][0] = 0;
    dp[1][1] = 1;
    for (int i=2; i<=6; i++) dp[1][i] = 0;
    for (int i=2; i<=N; i++) for (int j=1; j<=6; j++) {
        dp[i][j] = ( (dp[i-1][j] * j) + (dp[i-1][j-1] * (7-j)) ) / 6;
    }
        printf("%.10f\n",dp[N][6]);
    return 0;
}
0