結果

問題 No.567 コンプリート
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2019-08-25 00:15:56
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 478 ms / 2,000 ms
コード長 786 bytes
コンパイル時間 1,739 ms
コンパイル使用メモリ 166,536 KB
実行使用メモリ 89,600 KB
最終ジャッジ日時 2024-04-22 14:15:03
合計ジャッジ時間 3,272 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 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 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 478 ms
89,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i,n,m) for(int i = (int)(n); i < int(m); i++)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = MOD - 1;
const ll LLINF = 4e18;

int main() {
    int n; cin >> n;
    vector<vector<double>> dp(n + 1, vector<double>(7, 0));
    dp[0][0] = 1;
    FOR(i, 1, n + 1) {
        REP(j, 7) {
            dp[i][j] = dp[i - 1][j] * (double)(j)/6;
            if (j > 0) {
                dp[i][j] += dp[i - 1][j - 1] * ((double)(7 - j) / 6);
            }
        }
    }
    printf("%.10f", dp[n][6]);
    getchar(); getchar();
}
0