結果

問題 No.58 イカサマなサイコロ
ユーザー kotatsugamekotatsugame
提出日時 2017-09-20 16:57:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 478 bytes
コンパイル時間 593 ms
コンパイル使用メモリ 71,920 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-25 21:13:51
合計ジャッジ時間 1,111 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<iomanip>
using namespace std;
int 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];
				}
			}
		}
	}
	int 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)<<1.*win/all<<endl;
}
0