結果

問題 No.567 コンプリート
ユーザー pekempey
提出日時 2017-09-10 14:18:01
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 491 ms / 2,000 ms
コード長 334 bytes
コンパイル時間 718 ms
コンパイル使用メモリ 74,652 KB
最終ジャッジ日時 2025-01-05 02:53:47
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

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

  vector<double> dp(7);
  dp[0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 5; j >= 0; j--) {
      dp[j + 1] += dp[j] * (6 - j) / 6.0;
      dp[j] = dp[j] * j / 6.0;
    }
  }

  printf("%.20f\n", dp[6]);
}
0