結果
| 問題 |
No.58 イカサマなサイコロ
|
| ユーザー |
ldsyb
|
| 提出日時 | 2017-06-22 01:17:49 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4,952 ms / 5,000 ms |
| コード長 | 798 bytes |
| コンパイル時間 | 940 ms |
| コンパイル使用メモリ | 96,952 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-02 12:09:20 |
| 合計ジャッジ時間 | 55,986 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
#include <iostream>
#include <random>
#include <chrono>
#include <iomanip>
using namespace std;
int bitcount(int a){
int r = 0;
while(a){
r++;
a -= a & -a;
}
return r;
}
int main(){
int n, k;
cin >> n >> k;
random_device rnd;
mt19937 mt(rnd());
uniform_int_distribution<> rand16(1, 6), rand46(4, 6), randn((1 << k) - 1, (1 << n) - 1);
auto start = chrono::system_clock::now();
int all = 0, win = 0;
while(chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now() - start).count() < 4950){
int puni = 0, muni = 0;
for(int i = 0; i < k; i++) puni += rand46(mt);
for(int i = 0; i < n - k; i++) puni += rand16(mt);
for(int i = 0; i < n; i++) muni += rand16(mt);
all++;
if(muni < puni) win++;
}
cout << fixed << setprecision(10) << 1. * win / all << endl;
}
ldsyb