結果

問題 No.58 イカサマなサイコロ
ユーザー ferinferin
提出日時 2017-02-12 18:42:47
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 244 ms / 5,000 ms
コード長 743 bytes
コンパイル時間 1,856 ms
コンパイル使用メモリ 144,660 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-28 14:53:46
合計ジャッジ時間 3,483 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
4,376 KB
testcase_01 AC 244 ms
4,384 KB
testcase_02 AC 48 ms
4,380 KB
testcase_03 AC 26 ms
4,380 KB
testcase_04 AC 134 ms
4,380 KB
testcase_05 AC 157 ms
4,380 KB
testcase_06 AC 211 ms
4,376 KB
testcase_07 AC 48 ms
4,376 KB
testcase_08 AC 91 ms
4,376 KB
testcase_09 AC 210 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

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