結果
| 問題 |
No.58 イカサマなサイコロ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-12-24 05:35:07 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 38 ms / 5,000 ms |
| コード長 | 971 bytes |
| コンパイル時間 | 1,785 ms |
| コンパイル使用メモリ | 193,096 KB |
| 最終ジャッジ日時 | 2025-01-27 06:10:39 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
double dp[11][61];
double dp2[11][61];
int main(void)
{
cin.tie(0);
ios::sync_with_stdio(false);
dp[0][0] = 1;
dp2[0][0] = 1;
int n,k;
cin >> n;
cin >> k;
for(int i=0;i<n;i++)
{
for(int j=10*n;j>=0;j--)
{
for(int x=1;x<=6;x++)
{
if(j+x<=6*n)
{
dp[i+1][j+x] += (dp[i][j]/6);
}
}
}
}
for(int i=0;i<n;i++)
{
if(i < k)
{
for(int j=10*n;j>=0;j--)
{
for(int x=4;x<=6;x++)
{
if(j+x<=6*n)
{
dp2[i+1][j+x] += (dp2[i][j]/3);
}
}
}
}
else
{
for(int j=10*n;j>=0;j--)
{
for(int x=1;x<=6;x++)
{
if(j+x<=6*n)
{
dp2[i+1][j+x] += (dp2[i][j]/6);
}
}
}
}
}
double res = 0;
for(int i=0;i<=6*n;i++)
{
//cout << i << ' ' << dp[n][i] << '\n';
for(int j=i+1;j<=6*n;j++)
{
res += (dp[n][i]*dp2[n][j]);
}
}
cout << fixed;
cout.precision(6);
cout << res << '\n';
return 0;
}