結果

問題 No.65 回数の期待値の練習
ユーザー 0w1
提出日時 2016-11-21 00:43:49
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
MLE  
実行時間 -
コード長 432 bytes
コンパイル時間 1,916 ms
コンパイル使用メモリ 171,384 KB
実行使用メモリ 814,720 KB
最終ジャッジ日時 2024-11-27 09:19:21
合計ジャッジ時間 30,978 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample MLE * 4
other MLE * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int N;

double dfs( vector< vector< double > > &dp, int x, int t ){
  if( x >= N )
    return 1.0 * t;
  double res = 0;
  for( int i = 1; i <= 6; ++i )
    res += dfs( dp, x, t + 1 );
  return res / 6;
}

signed main(){
  cin >> N;
  vector< vector< double > > dp( N + 1, vector< double >( N + 6, -1 ) );
  cout << fixed << setprecision( 13 ) << dfs( dp, 0, 0 ) << endl;
  return 0;
}
0