結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 730 ms
6,816 KB
testcase_01 AC 3,659 ms
6,944 KB
testcase_02 AC 732 ms
6,944 KB
testcase_03 AC 375 ms
6,944 KB
testcase_04 AC 2,207 ms
6,944 KB
testcase_05 AC 2,524 ms
6,944 KB
testcase_06 AC 3,263 ms
6,940 KB
testcase_07 AC 774 ms
6,944 KB
testcase_08 AC 1,619 ms
6,940 KB
testcase_09 AC 3,265 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

signed main(){
  int N, K; cin >> N >> K;
  const int trial = ( int ) 1e7;
  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