結果

問題 No.58 イカサマなサイコロ
ユーザー naimonon77
提出日時 2016-01-14 12:10:25
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 750 bytes
コンパイル時間 1,242 ms
コンパイル使用メモリ 159,104 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-19 19:00:50
合計ジャッジ時間 4,946 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other RE * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
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