結果

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

ソースコード

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