結果

問題 No.574 正多面体サイコロ
ユーザー ryoissyryoissy
提出日時 2017-10-06 23:20:07
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 775 bytes
コンパイル時間 1,074 ms
コンパイル使用メモリ 144,956 KB
実行使用メモリ 11,788 KB
最終ジャッジ日時 2023-08-10 17:25:25
合計ジャッジ時間 2,312 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
8,952 KB
testcase_01 AC 7 ms
6,656 KB
testcase_02 AC 5 ms
6,964 KB
testcase_03 AC 5 ms
8,804 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 9 ms
8,944 KB
testcase_06 AC 3 ms
6,256 KB
testcase_07 AC 4 ms
6,732 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 18 ms
9,284 KB
testcase_10 AC 36 ms
10,264 KB
testcase_11 AC 2 ms
4,384 KB
testcase_12 AC 5 ms
6,848 KB
testcase_13 AC 2 ms
6,272 KB
testcase_14 AC 6 ms
8,900 KB
testcase_15 AC 5 ms
6,568 KB
testcase_16 AC 1 ms
4,384 KB
testcase_17 AC 7 ms
8,908 KB
testcase_18 AC 34 ms
11,788 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 1 ms
4,384 KB
testcase_22 AC 55 ms
11,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int f,n,k;
double dp[101][101][101];

int main(void){
	scanf("%d%d%d",&f,&n,&k);
	double ans=0.0;
	for(int num=1;num<=f;num++){
		for(int i=0;i<=n;i++){
			for(int j=0;j<=n;j++){
				for(int l=0;l<=n;l++){
					dp[i][j][l]=0.0;
				}
			}
		}
		dp[0][0][0]=1.0;
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				for(int l=0;l<n;l++){
					dp[i+1][j+1][l]+=(double)1.0/f*dp[i][j][l];
					dp[i+1][j][l+1]+=(double)(f-num)/f*dp[i][j][l];
					dp[i+1][j][l]+=(double)(num-1)/f*dp[i][j][l];
				}
			}
		}
		for(int i=0;i<=n;i++){
			for(int j=0;j<=n;j++){
				if(j<k && i+j>=k)ans+=(double)num*dp[n][i][j];
			}
		}
	}

	printf("%.10f\n",ans);
	return 0;
}
0