結果

問題 No.58 イカサマなサイコロ
ユーザー nenuon
提出日時 2017-06-25 16:18:54
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,673 ms / 5,000 ms
コード長 862 bytes
コンパイル時間 899 ms
コンパイル使用メモリ 99,056 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-04 08:53:23
合計ジャッジ時間 10,807 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

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 = 7000000;
  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("%.010lf\n", tarowin / times);
  return 0;
}
0