結果

問題 No.58 イカサマなサイコロ
ユーザー tonyu0tonyu0
提出日時 2020-03-26 11:09:22
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 587 bytes
コンパイル時間 861 ms
コンパイル使用メモリ 96,024 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-30 12:13:11
合計ジャッジ時間 1,758 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <random>
using namespace std;
random_device rd;
mt19937 mt(rd());

int n, k;

uniform_int_distribution<> rand1(1, 6);
uniform_int_distribution<> rand2(4, 6);


int main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> n >> k;

  int win = 0;
  for (int i = 0; i < 100000; ++i) {
    int taro = 0, jiro = 0;
    for (int j = 0; j < n; ++j) jiro += rand1(mt);
    for (int j = 0; j < n - k; ++j) taro += rand1(mt);
    for (int j = 0; j < k; ++j) taro += rand2(mt);
    win += (taro > jiro);
  }
  cout << (double)win / 100000.0 << '\n';
  return 0;
}

0