一道概率題 有 號9張牌 ?

時間 2021-11-07 05:40:21

1樓:小嚴

根據 @靈劍 的解法,寫了個程式實現,算出來9張牌全部翻開的概率大約是0.010325,和@趙明的結果很接近。

具體來說,翻完10次後,0張牌正面朝上的概率約為0.001999,1張牌0.017885,2張牌0.

071108,3張牌0.164837,4張牌0.245569,5張牌0.

243642,6張牌0.160522,7張牌0.067765,8張牌0.

016343,9張牌0.010325

static void Main(string args)

curStates = intermediateStates;

intermediateStates = new double[10Print output

Console.WriteLine(curStates[9Flip:

// For given state, calculate the next state after one flip

// Update resultStates accordingly

// curStates: array storing initial probabilities

// resultStates: array to store the result probabilities

// numberOfUpCards: Number of cards facing up(current state)

static void Flip(double curStates, double resultStates, int numberOfUpCards)

int totalCase = 0;

// could flip 1, 2 or 3 cards at a time, so (1/3) for each case

double eachFlipRate = 1.0 / 3;

// Flip 1 card

totalCase = 9; // A(9,1)

// 1 card facing up -> down

if (numberOfUpCards > 0resultStates[numberOfUpCards - 1] +=

curRate * eachFlipRate * numberOfUpCards / totalCase;

} // 1 card facing down -> up

if (numberOfDownCards > 0resultStates[numberOfUpCards + 1] +=

curRate * eachFlipRate * numberOfDownCards / totalCaseFlip 2 cards

totalCase = 9 * 8; // A(9,2)

// 2 cards facing up -> down

// numberOfUpCards * (numberOfUpCards - 1) cases

if (numberOfUpCards > 1resultStates[numberOfUpCards - 2] +=

curRate * eachFlipRate * numberOfUpCards * (numberOfUpCards - 1) / totalCase;

} // 1 card facing up -> down, 1 card facing down -> up

if (numberOfUpCards > 0 && numberOfDownCards > 0resultStates[numberOfUpCards] +=

curRate * eachFlipRate * numberOfUpCards * numberOfDownCards * 2 / totalCase;

} // 2 cards facing down -> up

// numberOfDownCards * (numberOfDownCards - 1) cases

if (numberOfDownCards > 1resultStates[numberOfUpCards + 2] +=

curRate * eachFlipRate * numberOfDownCards * (numberOfDownCards - 1) / totalCaseFlip 3

totalCase = 9 * 8 * 7; // A(9,3)

// 3 cards facing up -> down

// numberOfUpCards * (numberOfUpCards-1) * (numberOfUpCards-2)

if (numberOfUpCards > 2resultStates[numberOfUpCards - 3] +=

curRate * eachFlipRate * numberOfUpCards * (numberOfUpCards - 1) * (numberOfUpCards - 2) / totalCase;

} // 2 cards facing up -> down, 1 card facing down -> up = -1 up

// numberOfUpCards * (numberOfUpCards-1) * numberOfDownCards * A(3,1)

if (numberOfUpCards > 1 && numberOfDownCards > 0resultStates[numberOfUpCards - 1] +=

curRate * eachFlipRate * numberOfUpCards * (numberOfUpCards - 1) * numberOfDownCards * 3 / totalCase;

} // 1 card facing up -> down, 2 cards facing down -> up = +1 up

// numberOfUpCards * numberOfDownCards * (numberOfDownCards - 1) * A(3,1)

if (numberOfUpCards > 0 && numberOfDownCards > 1resultStates[numberOfUpCards + 1] +=

curRate * eachFlipRate * numberOfUpCards * numberOfDownCards * (numberOfDownCards - 1) * 3 / totalCase;

} // 3 cards facing down -> up

// numberOfDownCards * (numberOfDownCards - 1) * (numberOfDownCards - 2)

if (numberOfDownCards > 2resultStates[numberOfUpCards + 3] +=

curRate * eachFlipRate * numberOfDownCards * (numberOfDownCards - 1) * (numberOfDownCards - 2) / totalCase

2樓:InvsGhost

每次隨機翻開1-3張.那麼單次過程中每張牌被翻的概率P是:

單次概率P,重複N次,發生奇數次概率是 f(p,n)=[ 1 - (1-2p)^n ] / 2;

所以應該就是 ( f(P,10) )^9

大家都沒答。。心裡沒底(好久不看概論了)

一道概率題,遊戲怪物爆a10 概率,b5 概率,求打出一套平均需要打多少次?

消失的苦貓 突然關注到了這個六年前的老題,我看了下很多人問為什麼不是20,我試圖說一下。一道概率題,硬幣怪物爆正面50 概率,爆反面50 概率,求正反面各至少出現一次的平均次數是多少。如果按照 樸素的理解 也就是上面那道題不理解為什麼是20次的,在這裡應該會再次給出平均2次的回答,因為平均2次爆乙個...

問一道概率題,有點迷,不知道什麼原理。。。?

Leon Xue 95 患病概率百萬分之一是基於 病 的資訊 統計資料 那個人 在做化驗之前,得病概率就是百萬分之一。化驗之後,既然有了個人的新資訊,當然就是以化驗準確率作為得病概率了。這沒什麼可奇怪的。換個例子,你買了張彩票,開獎之前,中獎概率是千萬分之一 開獎之後,就是零或100 了。對同一事件...

學理有必要把每一道題搞懂嗎

乙個萌新 準確的說是把自己遇到的題能理解的去理解,最大程度地消化吧,題目是做不完的,而且人也不可能完全理解所有題,畢竟認知也有限,所以實在搞不懂的題也可以暫時放下,把基本問題,經典題目理解,弄明白就可以了 經典題搞懂。經典題就是你見過很多道題都和它長得很像的那種題。乙個型別一道就夠了。具體這個型別有...