結果

問題 No.242 ビンゴゲーム
ユーザー nmnmnmnmnmnmnmnmnmnmnmnmnmnm
提出日時 2015-06-24 00:07:58
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,670 bytes
コンパイル時間 700 ms
コンパイル使用メモリ 87,376 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-22 00:20:03
合計ジャッジ時間 10,525 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
 
#define MOD 1000000007

unsigned int xor128(void) { 
  static unsigned int x = 123456789;
  static unsigned int y = 362436069;
  static unsigned int z = 521288629;
  static unsigned int w = 88675123; 
  unsigned int t;
 
  t = x ^ (x << 11);
  x = y; y = z; z = w;
  return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); 
}

int m[12][5] = {
  {0,1,2,3,4},
  {5,6,7,8,9},
  {10,11,12,13,14},
  {15,16,17,18,19},
  {20,21,22,23,24},
  {0,5,10,15,20},
  {1,6,11,16,21},
  {2,7,12,17,22},
  {3,8,13,18,23},
  {4,9,14,19,24},
  {0,6,12,18,24},
  {4,8,12,16,20}
};
 
int main(){
  int n;
  cin>>n;
  int d[25];
  int ans = 0;
  int ra[99];
  rep(j,0,99)ra[j]=j;
  rep(i,0,1000000){
    int nn = 99;
    rep(j,0,99){
      swap(ra[xor128()%nn],ra[nn-1]);
      nn--;
    }
    clr(d,0);
    rep(j,0,n){
      if(ra[j]<25)d[ra[j]]=1;
    }
    int p = 0;
    rep(j,0,12){
      int c = 0;
      rep(k,0,5){
        if(d[m[j][k]]==1){
          c++;
        }
      }
      if(c==5)p++;
    }
    ans+=p;
  }
  printf("%.20f\n",1.*ans/1000000);
  return 0;
}

/*
  モンテカルロ法
*/
0