結果

問題 No.58 イカサマなサイコロ
ユーザー cielciel
提出日時 2015-06-19 03:47:32
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 573 ms / 5,000 ms
コード長 357 bytes
コンパイル時間 480 ms
コンパイル使用メモリ 63,644 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-21 09:39:55
合計ジャッジ時間 4,352 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
4,380 KB
testcase_01 AC 573 ms
4,376 KB
testcase_02 AC 121 ms
4,376 KB
testcase_03 AC 61 ms
4,380 KB
testcase_04 AC 353 ms
4,376 KB
testcase_05 AC 414 ms
4,380 KB
testcase_06 AC 525 ms
4,376 KB
testcase_07 AC 118 ms
4,384 KB
testcase_08 AC 233 ms
4,376 KB
testcase_09 AC 534 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <random>
#include <cstdio>
using namespace std;
int main(){
    int N,K,T=999999,S=0,I=0;
    scanf("%d%d",&N,&K);
    uniform_int_distribution<int>g(1,6),h(4,6);
    mt19937_64 e(0);
    for(;I<T;I++){
        int a=0,b=0,i=0;
        for(;i<N;i++)a+=g(e),b+=i<K?h(e):g(e);
        if(a<b)S++;
    }
    printf("%f\n",S*1.0/T);
}
0