結果

問題 No.567 コンプリート
ユーザー simansiman
提出日時 2021-09-09 11:11:37
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 179 ms / 2,000 ms
コード長 600 bytes
コンパイル時間 2,908 ms
コンパイル使用メモリ 103,700 KB
実行使用メモリ 58,312 KB
最終ジャッジ日時 2023-08-28 15:13:10
合計ジャッジ時間 4,943 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <limits.h>
#include <map>
#include <queue>
#include <set>
#include <string.h>
#include <vector>

using namespace std;
typedef long long ll;

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

  double dp[N + 1][7];
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1.0;

  for (int i = 0; i < N; ++i) {
    for (int j = 0; j <= 6; j++) {
      dp[i + 1][j + 1] += (6.0 - j) / 6.0 * dp[i][j];
      dp[i + 1][j] += (j / 6.0) * dp[i][j];
    }
  }

  cout << fixed << setprecision(10) << dp[N][6] << endl;

  return 0;
}
0