本码农写代码算了一下
一共有3770种抽签可能,拜仁对上巴萨是724种
应该是19.2%, 不知道是不是哪里弄错了
def uefa_lottery():
Group = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']
NationMap = {
"A1" : "Germany",
"A2" : "Spain",
"B1" : "Spain",
"B2" : "Germany",
"C1" : "Britain",
"C2" : "Portugue",
"D1" : "Britain",
"D2" : "Italy",
"E1" : "Britain",
"E2" : "Spain",
"F1" : "Germany",
"F2" : "Italy",
"G1" : "Italy",
"G2" : "Spain",
"H1" : "Germany",
"H2" : "France",
}
Target = "A1G2"
global _targetCnt, _allCnt
_targetCnt = 0
_allCnt = 0
def _loop(Team, Pair, I):
G = Group[I]
G1 = G + "1"
if not G1 in Team:
for _G in Group:
G2 = _G + "2"
if not G2 in Team and _G!=G and NationMap[G1]!=NationMap[G2]:
Team.append(G1)
Team.append(G2)
Pair.append(G1+G2)
if len(Pair) == 8:
global _targetCnt, _allCnt
if Target in Pair:
_targetCnt += 1
_allCnt += 1
print ",".join(Pair)
else:
_loop(Team, Pair, I+1)
Team.pop()
Team.pop()
Pair.pop()
Pair = []
Team = []
_loop(Team, Pair, 0)
print _targetCnt, _allCnt, float(_targetCnt)/float(_allCnt)
#724 3770 0.192042440318
【 在 tdhl 的大作中提到: 】
: 不知道扳手指处理不了数据量都叫大数据么?你怎么申请经费的
--
修改:Poacher FROM 60.191.37.*
FROM 60.191.37.*