結果

問題 No.58 イカサマなサイコロ
ユーザー DialBirdDialBird
提出日時 2017-02-20 06:44:02
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2,224 ms / 5,000 ms
コード長 888 bytes
コンパイル時間 607 ms
コンパイル使用メモリ 79,644 KB
実行使用メモリ 127,228 KB
最終ジャッジ日時 2023-08-28 19:31:11
合計ジャッジ時間 13,175 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 509 ms
106,232 KB
testcase_01 AC 2,224 ms
101,264 KB
testcase_02 AC 506 ms
105,704 KB
testcase_03 AC 320 ms
105,452 KB
testcase_04 AC 1,253 ms
115,004 KB
testcase_05 AC 1,443 ms
127,228 KB
testcase_06 AC 1,917 ms
93,860 KB
testcase_07 AC 517 ms
105,496 KB
testcase_08 AC 899 ms
104,692 KB
testcase_09 AC 1,888 ms
96,520 KB
権限があれば一括ダウンロードができます

ソースコード

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;
  vector<int> taro_sai(N);
  vector<int> jiro_sai(N);

  REP(i,0,trial) {
    int result = 0;
    REP(i,0,N){
      if (i < K) {
        result += rand() % 3 + 4;
      } else {
        result += rand() % 6 + 1;
      }
    }
    taro_sai.push_back(result);
  }

  REP(i,0,trial) {
    int result = 0;
    REP(i,0,N){
      result += rand() % 6 + 1;
    }
    jiro_sai.push_back(result);
  }

  double count = 0.0;
  REP(i,0,trial){
    if (taro_sai[i] > jiro_sai[i]) ++count;
  }

  printf("%1.5f\n", count / trial);
}
0