結果
| 問題 |
No.58 イカサマなサイコロ
|
| コンテスト | |
| ユーザー |
Dadarithm
|
| 提出日時 | 2015-10-11 11:10:46 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 411 ms / 5,000 ms |
| コード長 | 462 bytes |
| コンパイル時間 | 614 ms |
| コンパイル使用メモリ | 70,856 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-21 06:23:06 |
| 合計ジャッジ時間 | 3,435 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
#include <iostream>
#include <random>
#include <ctime>
using namespace std;
static const int INF = 1000000;
int main()
{
int N, K;
cin >> N >> K;
int A = 0, B = 0;
while (B <= INF)
{
int a = 0, b =0;
for (int i = 0; i < N; ++i)
b += rand() % 6 + 1;
for (int i = 0; i < K; ++i)
a += rand() % 3 + 4;
for (int i = 0; i < N - K; ++i)
a += rand() % 6 + 1;
if (a > b)
++A;
++B;
}
cout << (double)A / (double)B << endl;
return 0;
}
Dadarithm