結果
| 問題 |
No.58 イカサマなサイコロ
|
| コンテスト | |
| ユーザー |
a5ua
|
| 提出日時 | 2014-11-05 00:59:09 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 919 bytes |
| コンパイル時間 | 738 ms |
| コンパイル使用メモリ | 60,276 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-30 17:42:23 |
| 合計ジャッジ時間 | 1,463 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
int main()
{
const int D_MAX = 6 * 10;
int N, K;
cin >> N >> K;
vector<double> taro(D_MAX + 10, 0.0);
vector<double> jiro(D_MAX + 10, 0.0);
taro[0] = 1.0;
jiro[0] = 1.0;
for (int i = 0; i < N; ++i) {
vector<double> taro2(D_MAX + 10, 0.0);
vector<double> jiro2(D_MAX + 10, 0.0);
for (int j = 0; j <= D_MAX; ++j) {
if (i < K) {
for (int d = 4; d <= 6; ++d) {
taro2[j + d] += taro[j] / 3;
}
for (int d = 1; d <= 6; ++d) {
jiro2[j + d] += jiro[j] / 6;
}
} else {
for (int d = 1; d <= 6; ++d) {
taro2[j + d] += taro[j] / 6;
jiro2[j + d] += jiro[j] / 6;
}
}
}
swap(taro, taro2);
swap(jiro, jiro2);
}
double ans = 0.0;
for (int i = 0; i <= D_MAX; ++i) {
for (int j = 0; j < i; ++j) {
ans += taro[i] * jiro[j];
}
}
cout << ans << endl;
}
a5ua