結果

問題 No.58 イカサマなサイコロ
ユーザー DialBirdDialBird
提出日時 2017-02-20 06:56:44
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 740 bytes
コンパイル時間 720 ms
コンパイル使用メモリ 76,140 KB
実行使用メモリ 5,328 KB
最終ジャッジ日時 2023-08-28 19:30:36
合計ジャッジ時間 10,506 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <sstream>
#include <vector>
#include <array>
#include <string>
#include <algorithm>
#include <map>
#include <cmath>
#include <random>

using namespace std;

#define REP(i,first,last) for (int i=first;i<last;++i)
#define MAX(x,y) (x > y ? x : y)
#define MIN(x,y) (x < y ? x : y)

int N, K;
int trial = 9000000;

int main(){
  cin >> N >> K;
  int taro_win = 0;

  REP(i,0,trial) {
    int taro_result = 0;
    int jiro_result = 0;

    REP(i,0,N){
      if (i < K) {
        taro_result += rand() % 3 + 4;
      } else {
        taro_result += rand() % 6 + 1;
        jiro_result += rand() % 6 + 1;
      }
    } 
    if (taro_result > jiro_result) ++taro_win;
  }
  printf("%.5f\n", (double)taro_win / trial);
}
0