結果
問題 | No.58 イカサマなサイコロ |
ユーザー |
![]() |
提出日時 | 2025-01-13 00:43:47 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4,504 ms / 5,000 ms |
コード長 | 1,042 bytes |
コンパイル時間 | 5,283 ms |
コンパイル使用メモリ | 274,208 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-01-13 00:44:43 |
合計ジャッジ時間 | 55,150 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
#include <bits/stdc++.h>using namespace std;#ifdef LOCAL#include "settings/debug.cpp"#else#define Debug(...) void(0)#endif#define rep(i, n) for (int i = 0; i < (n); ++i)using ll = long long;using ull = unsigned long long;inline ull xor128() {static ull x = 123456789, y = 362436069, z = 521288629, w = 88675123;ull t = (x ^ (x << 11));x = y, y = z, z = w;return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));}int main() {auto start = chrono::system_clock::now();int n, k;cin >> n >> k;ull total = 0, win = 0;while (true) {auto now = chrono::system_clock::now();auto diff = chrono::duration_cast<chrono::milliseconds>(now - start).count();if (diff > 4500) break;++total;int taro = 0, jiro = 0;rep(i, n) {if (i < k)taro += xor128() % 3 + 4;elsetaro += xor128() % 6 + 1;jiro += xor128() % 6 + 1;}if (taro > jiro) ++win;}Debug(win, total);cout << fixed << setprecision(15) << (double) win / total << endl;return 0;}