結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 37 ms
5,376 KB
testcase_02 AC 9 ms
5,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 28 ms
5,376 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 17 ms
5,376 KB
testcase_09 AC 35 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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