結果

問題 No.242 ビンゴゲーム
ユーザー FF256grhyFF256grhy
提出日時 2017-07-16 14:35:22
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 3,495 bytes
コンパイル時間 1,338 ms
コンパイル使用メモリ 159,364 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-16 22:33:04
合計ジャッジ時間 1,855 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int d[26][13] = {
	{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 
	{ 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 
	{ 300, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 
	{ 2300, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 
	{ 12650, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 
	{ 53118, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 
	{ 176860, 240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 
	{ 478420, 2280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 
	{ 1067895, 13680, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 
	{ 1984881, 58048, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 
	{ 3083468, 184536, 756, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 
	{ 3998100, 453480, 5820, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 
	{ 4297872, 874664, 27716, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 
	{ 3780704, 1328328, 90492, 776, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 
	{ 2664548, 1575736, 211572, 5536, 8, 0, 0, 0, 0, 0, 0, 0, 0 }, 
	{ 1456572, 1430612, 358504, 22836, 236, 0, 0, 0, 0, 0, 0, 0, 0 }, 
	{ 587935, 958328, 435028, 59608, 2068, 8, 0, 0, 0, 0, 0, 0, 0 }, 
	{ 162362, 445644, 363960, 100544, 8883, 180, 2, 0, 0, 0, 0, 0, 0 }, 
	{ 27088, 129888, 194820, 106288, 21256, 1336, 24, 0, 0, 0, 0, 0, 0 }, 
	{ 2176, 19788, 57992, 64292, 28016, 4612, 220, 4, 0, 0, 0, 0, 0 }, 
	{ 48, 1064, 7296, 18136, 18106, 7368, 1064, 48, 0, 0, 0, 0, 0 }, 
	{ 0, 0, 186, 1498, 4148, 4528, 1998, 282, 10, 0, 0, 0, 0 }, 
	{ 0, 0, 0, 0, 128, 600, 932, 544, 96, 0, 0, 0, 0 }, 
	{ 0, 0, 0, 0, 0, 0, 24, 108, 132, 36, 0, 0, 0 }, 
	{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 8, 16, 0, 0 }, 
	{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }, 
};

double comb[100][100];

int main() {
	int n;
	cin >> n;
	
	inc(i, 100) {
	inc(j, 100) {
		comb[i][j] = (j == 0 ? 1 : (i == 0 ? 0 : comb[i - 1][j] + comb[i - 1][j - 1]));
	}
	}
	
	double ans = 0.0;
	incII(i, 0, min(n, 25)) {
		double a = 0.0, b = 0.0;
		incII(j, 0, 12) {
			a += d[i][j] * j;
			b += d[i][j];
		}
		ans += comb[25][i] * comb[99 - 25][n - i] * a / b;
	}
	
	printf("%.8f\n", ans / comb[99][n]);
	
	return 0;
}
0