結果

問題 No.75 回数の期待値の問題
ユーザー omochana1omochana1
提出日時 2014-12-03 01:31:06
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,118 bytes
コンパイル時間 1,137 ms
コンパイル使用メモリ 85,816 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-02 01:21:10
合計ジャッジ時間 2,178 ms
ジャッジサーバーID
(参考情報)
judge11 / judge16
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <string.h>
#include <map>
#include <fstream>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <set>
#include <climits>
#define MAX_N 510
#define PI 3.141592653589
#define ESP 1e-6
#define BS 10
#define MOD 1000000007 
#define ZERO 10001
#define YJSNPI 810
#define INF (1LL << 50)
#define ADD(a, b) a = (a + (ll)b) % MOD
#define MUL(a, b) a = (a * (ll)b) % MOD
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;

int N;
double dp[200][200];

int main() {
	scanf("%d", &N);
	double res = 0;
	dp[0][0] = 1;
	for(int i = 0; i < 200; i++) {
		for(int j = 0; j < N; j++) {
			if(dp[i][j] < ESP) continue;
			res += dp[i][j];
			for(int k = 1; k <= 6; k++) {
				if(j + k <= N) {
					dp[i][j + k] += dp[i][j] / 6;
				}
				else {
					dp[i + 1][0] += dp[i][j] / 6;
				}
			}
		}
	}
	printf("%.9f\n", res);
}
0