結果

問題 No.58 イカサマなサイコロ
ユーザー hiro71687k
提出日時 2023-08-25 17:08:00
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4,399 ms / 5,000 ms
コード長 703 bytes
コンパイル時間 4,249 ms
コンパイル使用メモリ 249,628 KB
最終ジャッジ日時 2025-02-16 13:33:52
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

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