結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 7 ms
4,384 KB
testcase_03 WA -
testcase_04 AC 17 ms
4,572 KB
testcase_05 WA -
testcase_06 AC 25 ms
4,384 KB
testcase_07 AC 8 ms
4,380 KB
testcase_08 AC 13 ms
4,384 KB
testcase_09 AC 24 ms
4,384 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() {
  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