結果
| 問題 |
No.58 イカサマなサイコロ
|
| ユーザー |
|
| 提出日時 | 2017-02-19 08:14:23 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,115 bytes |
| コンパイル時間 | 959 ms |
| コンパイル使用メモリ | 72,232 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-30 04:20:01 |
| 合計ジャッジ時間 | 1,371 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 10 |
ソースコード
#include <iostream>
#include <sstream>
#include <vector>
#include <array>
#include <string>
#include <algorithm>
#include <map>
#include <cmath>
using namespace std;
#define REP(i,first,last) for (int i=first;i<last;++i)
#define MAX(x,y) (x > y ? x : y)
#define MIN(x,y) (x < y ? x : y)
const int MAX_N = 10;
int N,K;
int main(){
cin >> N >> K;
double taro_dp[N+1][N*6+1];
double jiro_dp[N+1][N*6+1];
taro_dp[0][0] = 1;
jiro_dp[0][0] = 1;
// 太郎の結果
for (int i=1;i<=N;++i) {
for (int j=i;j<=N*6;++j) {
if (i <= K) {
for (int k=4;k<=6;++k) {
jiro_dp[i][j] += jiro_dp[i-1][j-k] / 3;
}
} else {
for (int k=1;k<=6;++k) {
jiro_dp[i][j] += jiro_dp[i-1][j-k] / 6;
}
}
}
}
//二郎の結果
for (int i=1;i<=N;++i) {
for (int j=i;j<=N*6;++j) {
for (int k=1;k<=6;++k) {
jiro_dp[i][j] += jiro_dp[i-1][j-k] / 6;
}
}
}
double result = 0;
for (int i=N;i<=N*6;++i) {
for (int j=N;j<i;++j) {
result += taro_dp[N][i] * jiro_dp[N][j];
}
}
cout << result << endl;
}