結果
問題 | No.58 イカサマなサイコロ |
ユーザー | moti |
提出日時 | 2015-07-22 09:28:01 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 454 ms / 5,000 ms |
コード長 | 804 bytes |
コンパイル時間 | 905 ms |
コンパイル使用メモリ | 91,772 KB |
実行使用メモリ | 4,384 KB |
最終ジャッジ日時 | 2023-09-22 21:11:17 |
合計ジャッジ時間 | 3,715 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 94 ms
4,384 KB |
testcase_01 | AC | 454 ms
4,376 KB |
testcase_02 | AC | 95 ms
4,380 KB |
testcase_03 | AC | 49 ms
4,380 KB |
testcase_04 | AC | 274 ms
4,380 KB |
testcase_05 | AC | 320 ms
4,380 KB |
testcase_06 | AC | 412 ms
4,376 KB |
testcase_07 | AC | 93 ms
4,380 KB |
testcase_08 | AC | 184 ms
4,380 KB |
testcase_09 | AC | 411 ms
4,376 KB |
ソースコード
#include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <complex> #include <queue> #include <set> #include <map> #include <iomanip> #include <random> using namespace std; #define REP(i,a,b) for(int i=a;i<(int)b;i++) #define rep(i,n) REP(i,0,n) typedef long long ll; default_random_engine gen; uniform_int_distribution<int> futu(1, 6); uniform_int_distribution<int> ikasama(4, 6); int solve(int N, int K) { int taro = 0, jiro = 0; rep(i, N-K) { taro += futu(gen); jiro += futu(gen); } rep(i, K) { taro += ikasama(gen); jiro += futu(gen); } return taro > jiro; } int main() { int N, K; cin >> N >> K; ll ans = 0; rep(_, 1000000) { ans += solve(N, K); } cout << setprecision(5) << (double)ans / 1000000 << endl; return 0; }