結果

問題 No.58 イカサマなサイコロ
ユーザー hiro71687khiro71687k
提出日時 2023-08-25 17:08:00
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2,526 ms / 5,000 ms
コード長 703 bytes
コンパイル時間 4,169 ms
コンパイル使用メモリ 258,956 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-25 17:08:19
合計ジャッジ時間 18,802 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 539 ms
4,376 KB
testcase_01 AC 2,526 ms
4,380 KB
testcase_02 AC 535 ms
4,384 KB
testcase_03 AC 307 ms
4,380 KB
testcase_04 AC 1,438 ms
4,384 KB
testcase_05 AC 1,646 ms
4,380 KB
testcase_06 AC 2,184 ms
4,380 KB
testcase_07 AC 565 ms
4,380 KB
testcase_08 AC 1,003 ms
4,376 KB
testcase_09 AC 2,210 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll mod=998244353;
ll inf=1009999999999999990;
int main(){
    ll n,k;
    cin >> n >> k;
    ld ans=0;
    for (ll i = 0; i < 10000000; i++)
    {
        ll x=0;
        for (ll j = 0; j < k; j++)
        {
            x+=rand()%3+4;
        }
        for (ll j = 0; j < n-k; j++)
        {
            x+=rand()%6+1;
        }
        for (ll j = 0; j < n; j++)
        {
            x-=rand()%6+1;
        }
        if (x>0)
        {
            ans++;
        }
    }
    ans/=10000000.0;
    cout << setprecision(100) << ans << endl;
}
0