結果

問題 No.76 回数の期待値で練習
ユーザー fiordfiord
提出日時 2015-08-09 14:50:33
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 248 ms / 5,000 ms
コード長 315 bytes
コンパイル時間 2,227 ms
コンパイル使用メモリ 143,700 KB
実行使用メモリ 81,760 KB
最終ジャッジ日時 2023-09-25 07:28:58
合計ジャッジ時間 2,426 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 246 ms
81,680 KB
testcase_01 AC 248 ms
81,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
double dp[10000000];
int p[]={12,6,4,12,4,6};
int main(){
	for(int i=0;i<10000000;i++){
		for(int j=1;j<=min(i,6);j++){
			dp[i]+=dp[i-j]/p[j-1];
		}
		dp[i]++;
		
	}
	int t;	cin>>t;
	for(int i=0;i<t;i++){
		int n;	cin>>n;
		printf("%.15lf\n",dp[n-1]);
	}
	return 0;
}
0