結果

問題 No.58 イカサマなサイコロ
ユーザー tonyu0
提出日時 2020-03-26 11:09:22
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 587 bytes
コンパイル時間 1,317 ms
コンパイル使用メモリ 96,428 KB
最終ジャッジ日時 2025-01-09 10:18:34
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 WA * 4
権限があれば一括ダウンロードができます

ソースコード

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