結果

問題 No.58 イカサマなサイコロ
ユーザー face4face4
提出日時 2018-06-03 14:01:19
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 529 bytes
コンパイル時間 535 ms
コンパイル使用メモリ 69,384 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-12 21:51:18
合計ジャッジ時間 2,060 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
4,380 KB
testcase_01 AC 121 ms
4,376 KB
testcase_02 AC 22 ms
4,380 KB
testcase_03 AC 12 ms
4,380 KB
testcase_04 AC 66 ms
4,384 KB
testcase_05 WA -
testcase_06 AC 105 ms
4,380 KB
testcase_07 AC 24 ms
4,384 KB
testcase_08 AC 46 ms
4,380 KB
testcase_09 AC 101 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<iomanip>
using namespace std;

int main(){
    int n, k;
    cin >> n >> k;

    int total = 0, win = 0;
    for(int i = 0; i < 500000; i++){
        int taro = 0, ziro = 0;

        for(int j = 0; j < n; j++)      ziro += rand()%6 + 1;
        for(int j = 0; j < n-k; j++)    taro += rand()%6 + 1;
        for(int j = 0; j < k; j++)      taro += rand()%3 + 4;

        if(taro > ziro) win++;
        total++;
    }

    cout << fixed << setprecision(5) << (double)win / total << endl;
    return 0;
}
0