結果

問題 No.65 回数の期待値の練習
ユーザー mayoko_
提出日時 2015-02-04 15:46:57
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 4 ms / 5,000 ms
コード長 539 bytes
コンパイル時間 581 ms
コンパイル使用メモリ 73,292 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-23 07:28:36
合計ジャッジ時間 1,332 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>

#define INF 1000000000

using namespace std;
typedef long long ll;

double dfs(int k) {
    if (k <= 0) return 0;
    return 1+(1.0/6) * (dfs(k-1)+dfs(k-2)+dfs(k-3)+dfs(k-4)+dfs(k-5)+dfs(k-6));
}

int main(void) {
    int K;
    cin >> K;
    printf("%.10lf\n", dfs(K));
    return 0;
}
0