結果

問題 No.58 イカサマなサイコロ
ユーザー cielciel
提出日時 2015-06-19 03:43:16
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 1,190 ms / 5,000 ms
コード長 549 bytes
コンパイル時間 453 ms
コンパイル使用メモリ 63,456 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-21 09:38:27
合計ジャッジ時間 7,828 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 243 ms
4,380 KB
testcase_01 AC 1,190 ms
4,376 KB
testcase_02 AC 245 ms
4,376 KB
testcase_03 AC 125 ms
4,380 KB
testcase_04 AC 721 ms
4,380 KB
testcase_05 AC 840 ms
4,376 KB
testcase_06 AC 1,076 ms
4,380 KB
testcase_07 AC 243 ms
4,380 KB
testcase_08 AC 480 ms
4,376 KB
testcase_09 AC 1,083 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <random>
#include <cstdio>
#include <ctime>
#include <unistd.h>
using namespace std;

int main(){
    int N,K;
    scanf("%d%d",&N,&K);
    int T=2000000;
    int S=0;
    uniform_int_distribution<int> gooddice(1,6);
    uniform_int_distribution<int> badddice(4,6);
    mt19937_64 engine(0);
    for(int I=0;I<T;I++){
        int a=0,b=0,i=0;
        for(;i<K;i++)a+=gooddice(engine),b+=badddice(engine);
        for(;i<N;i++)a+=gooddice(engine),b+=gooddice(engine);
        if(a<b)S++;
    }
    printf("%f\n",S*1.0/T);
}
0