結果

問題 No.58 イカサマなサイコロ
ユーザー maine_honzukimaine_honzuki
提出日時 2020-05-08 22:44:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 179 ms / 5,000 ms
コード長 462 bytes
コンパイル時間 1,432 ms
コンパイル使用メモリ 166,232 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-17 03:15:54
合計ジャッジ時間 2,921 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
4,376 KB
testcase_01 AC 179 ms
4,376 KB
testcase_02 AC 39 ms
4,380 KB
testcase_03 AC 25 ms
4,376 KB
testcase_04 AC 106 ms
4,376 KB
testcase_05 AC 122 ms
4,380 KB
testcase_06 AC 156 ms
4,380 KB
testcase_07 AC 43 ms
4,376 KB
testcase_08 AC 76 ms
4,380 KB
testcase_09 AC 156 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int N, K;
    cin >> N >> K;

    mt19937 mt;

    int cnt = 0, MAX = 1000000;
    for (int times = 0; times < MAX; times++) {
        int tarou = 0, jirou = 0;
        for (int i = 0; i < N; i++) {
            jirou += mt() % 6 + 1;
            tarou += (i < K ? mt() % 3 + 4 : mt() % 6 + 1);
        }
        if (tarou > jirou)
            cnt++;
    }

    cout << (double)cnt / MAX << endl;
}
0