結果

問題 No.242 ビンゴゲーム
ユーザー TawaraTawara
提出日時 2015-07-31 19:20:08
言語 PyPy2
(7.3.15)
結果
TLE  
実行時間 -
コード長 782 bytes
コンパイル時間 432 ms
コンパイル使用メモリ 78,004 KB
実行使用メモリ 76,368 KB
最終ジャッジ日時 2023-09-24 22:33:12
合計ジャッジ時間 5,474 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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