結果

問題 No.58 イカサマなサイコロ
ユーザー kotatsugamekotatsugame
提出日時 2017-09-20 17:07:48
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 485 bytes
コンパイル時間 617 ms
コンパイル使用メモリ 71,908 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-25 21:13:56
合計ジャッジ時間 1,104 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<iomanip>
using namespace std;
long dp[11][200],n,k;
int a[]={1,2,3,4,5,6},b[]={4,5,6,4,5,6};
int main()
{
	cin>>n>>k;
	dp[0][100]=1;
	for(int i=0;i<n;i++)
	{
		for(int l=10;l<190;l++)
		{
			for(int j=0;j<6;j++)
			{
				for(int u=0;u<6;u++)
				{
					dp[i+1][l+(i<k?b:a)[j]-a[u]]+=dp[i][l];
				}
			}
		}
	}
	long all=0,win=0;
	for(int i=0;i<200;i++)
	{
		all+=dp[n][i];
		win+=i>100?dp[n][i]:0;
	}
	cout<<fixed<<setprecision(9)<<(double)win/all<<endl;
}
0