結果

問題 No.58 イカサマなサイコロ
ユーザー 0w10w1
提出日時 2016-11-25 16:18:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 359 ms / 5,000 ms
コード長 529 bytes
コンパイル時間 1,330 ms
コンパイル使用メモリ 166,572 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-05 13:29:03
合計ジャッジ時間 3,888 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
5,248 KB
testcase_01 AC 359 ms
5,376 KB
testcase_02 AC 74 ms
5,376 KB
testcase_03 AC 39 ms
5,376 KB
testcase_04 AC 221 ms
5,376 KB
testcase_05 AC 255 ms
5,376 KB
testcase_06 AC 324 ms
5,376 KB
testcase_07 AC 76 ms
5,376 KB
testcase_08 AC 147 ms
5,376 KB
testcase_09 AC 333 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

signed main(){
  int N, K; cin >> N >> K;
  const int trial = ( int ) 1e6;
  int win_cnt = 0;
  for( int i = 0; i < trial; ++i ){
    int nirou = 0;
    for( int j = 0; j < N; ++j )
      nirou += rand() % 6 + 1;
    int tarou = 0;
    for( int j = 0; j < N - K; ++j )
      tarou += rand() % 6 + 1;
    for( int j = 0; j < K; ++j )
      tarou += rand() % 3 + 4;
    win_cnt += tarou > nirou;
  }
  cout << fixed << setprecision( 6 ) << 1.0 * win_cnt / trial << endl;
  return 0;
}
0