[CareerCup] 7.2 Ants on Polygon 多邊形上的螞蟻

Grandyang發表於2015-08-28

 

7.2 There are three ants on different vertices of a triangle. What is the probability of collision (between any two or all of them) if they start walking on the sides of the triangle? Assume that each ant randomly picks a direction, with either direction being equally likely to be chosen, and that they walk at the same speed. Similarly, find the probability of collision with n ants on an n-vertex polygon.

 

這道題說有一個三角形,每個頂點上有一隻螞蟻,如果它們隨機選一個方向勻速爬,問任意兩隻會碰撞的概率是多少?然後又擴充到n邊形,放n只螞蟻,還是求會碰撞的概率。

我剛開始還在考慮三角形是否為等邊三角形,其實跟這些都沒啥關係。任意兩隻螞蟻碰撞的概率不好求,我們可以反其道行之,先求出不會碰撞的概率,然後取個反也能達到目的。那麼不會有碰撞的概率只有兩種情況,所有螞蟻都順時針爬,或者都逆時針爬。那麼對於三角形來說,3只螞蟻都順時針爬的概率是0.53,都逆時針爬的概率也是0.53,則相同方向爬的概率是0.53+0.53=0.25,則會碰撞的概率為1-0.25=0.75。那麼對於n邊形和n只螞蟻也是同理,n只螞蟻都順時針爬的概率是0.5n,都逆時針爬的概率也是0.5n,則相同方向爬的概率是0.5n+0.5n=0.5n-1,則會碰撞的概率為1-0.5n-1

 

相關文章