結果

問題 No.65 回数の期待値の練習
ユーザー 0w10w1
提出日時 2016-11-21 00:43:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 432 bytes
コンパイル時間 1,641 ms
コンパイル使用メモリ 169,344 KB
実行使用メモリ 814,356 KB
最終ジャッジ日時 2023-08-18 06:01:40
合計ジャッジ時間 5,414 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

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