我試圖做一個python腳本來計算一些贏/失機會。 做到這一點我試圖下車的戰績所有可能的組合(K是贏得比賽所需的勝場數):python itertools產品重複到大
for combination in itertools.product(['W','L'], repeat=(K*2)-1):
if ((combination.count('L') < K) and (combination.count('W') == K)):
#calculate the chance of this situation happening
由於某種原因,這工作得很好,直到重複變成大(例如,如果K = 25) 有人可以給我一些指導如何解決這個問題嗎?
答案在於數學而不是代碼。 – 0xc0de