結果

問題 No.58 イカサマなサイコロ
ユーザー ferin
提出日時 2017-02-12 18:42:47
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 416 ms / 5,000 ms
コード長 743 bytes
コンパイル時間 2,051 ms
コンパイル使用メモリ 158,572 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-29 16:55:13
合計ジャッジ時間 4,305 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (int i = (int)a; i < (int)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265359
#define EPS 1e-12

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

  int tot = 0, win = 0;
  REP(j, 1000000) {
    int a = 0, b = 0;
    REP(i, n) a += rand() % 6 + 1;
    REP(i, k) b += rand() % 3 + 4;
    REP(i, n - k) b += rand() % 6 + 1;
    if(b > a) win++;
    tot++;
  }

  cout << fixed << setprecision(9) << (double)win/tot << endl;
  return 0;
}
0