結果

問題 No.574 正多面体サイコロ
ユーザー ryoissyryoissy
提出日時 2017-10-06 23:20:07
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 775 bytes
コンパイル時間 1,366 ms
コンパイル使用メモリ 158,824 KB
実行使用メモリ 11,792 KB
最終ジャッジ日時 2024-04-28 10:50:59
合計ジャッジ時間 2,004 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
8,652 KB
testcase_01 AC 6 ms
6,940 KB
testcase_02 AC 4 ms
7,964 KB
testcase_03 AC 4 ms
8,052 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 7 ms
8,176 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 16 ms
8,980 KB
testcase_10 AC 28 ms
10,220 KB
testcase_11 AC 1 ms
6,944 KB
testcase_12 AC 4 ms
6,940 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 5 ms
8,664 KB
testcase_15 AC 5 ms
8,108 KB
testcase_16 AC 1 ms
6,944 KB
testcase_17 AC 6 ms
8,492 KB
testcase_18 AC 27 ms
11,528 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 1 ms
6,940 KB
testcase_21 AC 1 ms
6,944 KB
testcase_22 AC 43 ms
11,792 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         scanf("%d%d%d",&f,&n,&k);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~

ソースコード

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