結果

問題 No.58 イカサマなサイコロ
ユーザー nenuonnenuon
提出日時 2017-06-25 16:15:41
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 769 ms / 5,000 ms
コード長 861 bytes
コンパイル時間 829 ms
コンパイル使用メモリ 101,704 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-15 01:29:15
合計ジャッジ時間 5,680 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 178 ms
6,812 KB
testcase_01 AC 769 ms
6,940 KB
testcase_02 AC 169 ms
6,944 KB
testcase_03 AC 107 ms
6,940 KB
testcase_04 AC 469 ms
6,940 KB
testcase_05 AC 540 ms
6,940 KB
testcase_06 AC 693 ms
6,944 KB
testcase_07 AC 191 ms
6,944 KB
testcase_08 AC 330 ms
6,940 KB
testcase_09 AC 681 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <random>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
typedef long long ll;

int main(){
  int N, K;
  cin >> N >> K;
  random_device rnd;
  mt19937 mt(rnd());
  uniform_int_distribution<> rand16(1, 6);
  uniform_int_distribution<> rand46(4, 6);
  double times = 5000000;
  double tarowin = 0;
  FOR(i,0,times){
    int taro = 0, jiro = 0;
    FOR(i,0,N){
      jiro += rand16(mt);
    }
    FOR(i,0,K){
      taro += rand46(mt);
    }
    FOR(i,0,N-K){
      taro += rand16(mt);
    }
    if(taro > jiro) tarowin++;
  }
  printf("%.05lf\n", tarowin / times);
  return 0;
}
0