結果

問題 No.65 回数の期待値の練習
ユーザー 0w10w1
提出日時 2016-11-21 00:44:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 395 bytes
コンパイル時間 1,451 ms
コンパイル使用メモリ 163,964 KB
実行使用メモリ 813,532 KB
最終ジャッジ日時 2023-08-18 06:01:47
合計ジャッジ時間 4,406 ms
ジャッジサーバーID
(参考情報)
judge11 / 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( int x, int t ){
  if( x >= N )
    return 1.0 * t;
  double res = 0;
  for( int i = 1; i <= 6; ++i )
    res += dfs( 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( 0, 0 ) << endl;
  return 0;
}
0