結果
| 問題 |
No.58 イカサマなサイコロ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-17 14:55:51 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 176 ms / 5,000 ms |
| コード長 | 918 bytes |
| コンパイル時間 | 1,507 ms |
| コンパイル使用メモリ | 107,828 KB |
| 最終ジャッジ日時 | 2025-01-11 21:45:39 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
| 純コード判定しない問題か言語 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
int a[6]={1,2,3,4,5,6};
int b[6]={4,4,5,5,6,6};
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
return (ull)rng() % B;
}
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n,k; cin >> n >> k;
int cnt=0;
for(int i=0;i<1e6;i++){
int score=0;
for(int i=0;i<n;i++){
score+=a[myRand(6)];
}
int score2=0;
for(int i=0;i<n;i++){
if(i<k)score2+=b[myRand(6)];
else score2+=a[myRand(6)];
}
if(score2>score)cnt++;
}
printf("%.9f\n",(double)(cnt/1e6) );
}