結果

問題 No.76 回数の期待値で練習
ユーザー sugim48sugim48
提出日時 2014-11-23 23:29:32
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 951 bytes
コンパイル時間 524 ms
コンパイル使用メモリ 76,180 KB
実行使用メモリ 18,068 KB
最終ジャッジ日時 2023-08-30 22:21:41
合計ジャッジ時間 1,938 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	int T; cin >> T;
	while (T--) {
		int N; cin >> N;
		vector<double> dp(N + 1, 1);
		dp[0] = 0;
		for (int i = 1; i <= N; i++)
			for (int j = 1; j <= 12; j++) {
				int _i = max(0, i - j);
				dp[i] += dp[_i] / 12;
			}
		printf("%.10f\n", dp[N]);
	}
}
0