結果

問題 No.76 回数の期待値で練習
ユーザー Kmcode1Kmcode1
提出日時 2014-11-24 00:20:32
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 890 bytes
コンパイル時間 597 ms
コンパイル使用メモリ 88,520 KB
実行使用メモリ 11,984 KB
最終ジャッジ日時 2023-08-30 22:38:20
合計ジャッジ時間 13,061 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<ctime>
#include<complex>
#include<functional>
#include<climits>
#include<cassert>
#include<iterator>
using namespace std;
int t;
int n;
long long int countt = 0;
long long int m;
void dfs(int sum,int kai){
	if (sum <= 0){
		countt++;
		m += kai;
		return;
	}
	for (int j = 1; j <= 6; j++){
		dfs(sum - j, kai+1);
	}
	return;
}
int main(){
	scanf("%d", &t);
	while (t--){
		m = 0;
		countt = 0;
		scanf("%d", &n);
		dfs(n,0);
		double ans = (double)m / (double)countt;
		printf("%.7f\n", ans);
	}
	return 0;
}
0