結果
問題 |
No.58 イカサマなサイコロ
|
ユーザー |
|
提出日時 | 2017-02-20 06:44:02 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3,959 ms / 5,000 ms |
コード長 | 888 bytes |
コンパイル時間 | 2,335 ms |
コンパイル使用メモリ | 86,552 KB |
実行使用メモリ | 124,240 KB |
最終ジャッジ日時 | 2024-12-30 05:49:38 |
合計ジャッジ時間 | 24,375 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
#include <iostream> #include <sstream> #include <vector> #include <array> #include <string> #include <algorithm> #include <map> #include <cmath> #include <random> using namespace std; #define REP(i,first,last) for (int i=first;i<last;++i) #define MAX(x,y) (x > y ? x : y) #define MIN(x,y) (x < y ? x : y) int N, K; int trial = 9000000; int main(){ cin >> N >> K; vector<int> taro_sai(N); vector<int> jiro_sai(N); REP(i,0,trial) { int result = 0; REP(i,0,N){ if (i < K) { result += rand() % 3 + 4; } else { result += rand() % 6 + 1; } } taro_sai.push_back(result); } REP(i,0,trial) { int result = 0; REP(i,0,N){ result += rand() % 6 + 1; } jiro_sai.push_back(result); } double count = 0.0; REP(i,0,trial){ if (taro_sai[i] > jiro_sai[i]) ++count; } printf("%1.5f\n", count / trial); }