結果

問題 No.58 イカサマなサイコロ
ユーザー DialBird
提出日時 2017-02-20 06:56:44
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 740 bytes
コンパイル時間 2,248 ms
コンパイル使用メモリ 82,500 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-30 05:48:26
合計ジャッジ時間 19,194 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 WA * 8
権限があれば一括ダウンロードができます

ソースコード

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