結果

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

テストケース

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

ソースコード

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++)
	{
		cout<<dp[n][i]<<" ";
		all+=dp[n][i];
		win+=i>100?dp[n][i]:0;
	}
	cout<<fixed<<setprecision(9)<<(double)win/all<<endl;
}
0