結果

問題 No.242 ビンゴゲーム
ユーザー Tawara
提出日時 2015-07-31 19:20:08
言語 PyPy2
(7.3.15)
結果
TLE  
実行時間 -
コード長 782 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 77,076 KB
実行使用メモリ 87,032 KB
最終ジャッジ日時 2024-07-17 22:59:58
合計ジャッジ時間 3,833 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 TLE * 1 -- * 1
other -- * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import combinations as combs
from math import factorial as fact
def Comb(A,B):
	return fact(A)/(fact(A-B)*fact(B))

N = int(raw_input())
MAX_N = 99
ans = 0.0
card_num = xrange(25)
for i in range(max(5,25 + N - MAX_N),min(N+1,26)):
	prob = Comb(74,N-i)
	for call in combs(card_num,i):
		call = set(call)
		line = 0
		for i in range(5):
			for j in range(5):
				if i*5 + j in call:
					continue
				break
			else:
				line += 1
		for i in range(5):
			for j in range(5):
				if i + 5*j in call:
					continue
				break
			else:
				line += 1
		for i in range(5):
			if i + 5*i in call:
				continue
			break
		else:
			line += 1
		for i in range(5):
			if i + 5*(4-i) in call:
				continue
			break
		else:
			line += 1
		ans += prob * line
print ans / Comb(MAX_N, N)
0