結果

問題 No.58 イカサマなサイコロ
ユーザー ninoinuininoinui
提出日時 2020-08-24 10:40:24
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 110 ms / 5,000 ms
コード長 440 bytes
コンパイル時間 2,189 ms
コンパイル使用メモリ 198,344 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-24 01:53:49
合計ジャッジ時間 3,472 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
6,816 KB
testcase_01 AC 110 ms
6,944 KB
testcase_02 AC 26 ms
6,940 KB
testcase_03 AC 20 ms
6,940 KB
testcase_04 AC 66 ms
6,944 KB
testcase_05 AC 75 ms
6,944 KB
testcase_06 AC 97 ms
6,944 KB
testcase_07 AC 32 ms
6,940 KB
testcase_08 AC 51 ms
6,944 KB
testcase_09 AC 92 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  int win = 0;
  random_device rd;
  mt19937 mt(rd());
  for (int i = 1e6; i; i--) {
    int taro = 0;
    int jiro = 0;
    for (int i = 0; i < N; i++) {
      jiro += mt() % 6 + 1;
      if (i < K) taro += mt() % 3 + 4;
      else taro += mt() % 6 + 1;
    }
    if (taro > jiro) win++;
  }
  cout << fixed << setprecision(3) << win / 1e6 << "\n";
}
0