結果

問題 No.76 回数の期待値で練習
ユーザー Kmcode1Kmcode1
提出日時 2014-11-23 23:31:49
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 938 bytes
コンパイル時間 650 ms
コンパイル使用メモリ 89,100 KB
実行使用メモリ 7,892 KB
最終ジャッジ日時 2023-08-30 22:22:37
合計ジャッジ時間 13,067 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 j,int sum,int kai){
	if (j == 6){
		if (sum % 6 == 0){
			countt++;
			m+=kai+(sum/6);
		}
		return;
	}
	else{
		for (int k = 0; j*k + sum <= n; k++){
			dfs(j + 1, sum - j*k, kai+k);
		}
		return;
	}
}
int main(){
	scanf("%d", &t);
	while (t--){
		scanf("%d", &n);
		dfs(1, 0,0);
		double ans = (double)m / (double)countt;
		printf("%.7f", ans);
	}
	return 0;
}
0