結果
問題 | No.58 イカサマなサイコロ |
ユーザー | tetsuzuki1115 |
提出日時 | 2017-09-28 03:32:20 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 527 ms / 5,000 ms |
コード長 | 1,025 bytes |
コンパイル時間 | 729 ms |
コンパイル使用メモリ | 88,488 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-08-09 20:26:44 |
合計ジャッジ時間 | 4,587 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 111 ms
4,376 KB |
testcase_01 | AC | 527 ms
4,380 KB |
testcase_02 | AC | 109 ms
4,380 KB |
testcase_03 | AC | 57 ms
4,376 KB |
testcase_04 | AC | 319 ms
4,376 KB |
testcase_05 | AC | 364 ms
4,376 KB |
testcase_06 | AC | 466 ms
4,376 KB |
testcase_07 | AC | 112 ms
4,376 KB |
testcase_08 | AC | 206 ms
4,380 KB |
testcase_09 | AC | 471 ms
4,380 KB |
ソースコード
#include <iostream> #include <vector> #include <string> #include <cstring> #include <math.h> #include <cmath> #include <limits.h> #include <map> #include <set> #include <queue> #include <algorithm> #include <functional> #include <stdio.h> #include <random> using namespace std; long long MOD = 1000000007; int main() { int N,K; cin >> N >> K; random_device seed_gen; mt19937 engine(seed_gen()); uniform_real_distribution<> dist(0, 1.0); long long win = 0; for ( long long n = 0; n < 1000000; n++ ) { int T = 0; int J = 0; for ( int i = 0; i < N; i++ ) { J += floor( dist(engine)*6 ) + 1; } for ( int i = 0; i < N-K; i++ ) { T += floor( dist(engine)*6 ) + 1; } for ( int i = 0; i < K; i++ ) { T += floor( dist(engine)*3 ) + 4; } if ( T > J ) { win++; } } printf( "%f", static_cast<double>(win) / 1000000.0 ); return 0; }