結果

問題 No.58 イカサマなサイコロ
ユーザー naimonon77naimonon77
提出日時 2016-01-14 12:10:25
言語 C++11
(gcc 11.4.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 750 bytes
コンパイル時間 1,379 ms
コンパイル使用メモリ 159,708 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 23:03:13
合計ジャッジ時間 5,458 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:18:13: warning: format ‘%llu’ expects argument of type ‘long long unsigned int*’, but argument 2 has type ‘int*’ [-Wformat=]
   18 |   scanf("%llu %llu",&N,&K);
      |          ~~~^       ~~
      |             |       |
      |             |       int*
      |             long long unsigned int*
      |          %u
main.cpp:18:18: warning: format ‘%llu’ expects argument of type ‘long long unsigned int*’, but argument 3 has type ‘int*’ [-Wformat=]
   18 |   scanf("%llu %llu",&N,&K);
      |               ~~~^     ~~
      |                  |     |
      |                  |     int*
      |                  long long unsigned int*
      |               %u
main.cpp:18:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   18 |   scanf("%llu %llu",&N,&K);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
/* ここからが本編 */
/*  */
int main(void)
{
  int i,j,k;
  int N,K;
  int tarou_win = 0;
  int trial_cnt = 1000000;
  scanf("%llu %llu",&N,&K);
  // cin >> N >> K;
  // tarouがせこする
  for(i=0;i<trial_cnt;i++) {
    ull tarou_sum = 0,zirou_sum = 0;
    for(j=0;j<K;j++) {
      tarou_sum += rand() % 3 + 4;
    }
    for(;j<N;j++) {
      tarou_sum += rand() % 6 + 1;
    }
    for(j=0;j<N;j++) {
      zirou_sum += rand() % 6 + 1;
    }
    if(tarou_sum > zirou_sum) tarou_win++;
  }
  printf("%lf\n",(double)tarou_win/trial_cnt);
  return 0;
}
0