三國殺中曹沖「稱象」所獲牌數期望是多少?
稱象——每當你受到傷害後,你可以亮出牌堆頂的四張牌,然後獲得其中的至少一張點數之和不大於13的牌,將其餘的牌置入棄牌堆。
謝謝邀請。
先貼一下曹沖【稱象】技能的描述(2014年版本):
【稱象】——每當你受到傷害後,你可以亮出牌堆頂的四張牌,然後獲得其中的至少一張點數之和小於13的牌,將其餘的牌置入棄牌堆。
既然題主假設牌堆無限,那麼抽到每個點數的概率都是,於是總共有種取牌的可能。用貪心演算法,總是取點數最小的幾張牌。除非四張牌都是K,否則總是能取到牌。
懶得動腦筋手算,所以接下來就是Java時間了:
import java.util.Arrays;
public class CaoChongChengXiang2{
public static int[] cccx(int Nmax){
int[] number={1,1,1,1};
int[] takeCards={0,0,0,0,0};
final int totalArrays=(int)Math.pow(Nmax,4);
for(int i=0;i&
takeCards[j]++;
break;
}
if(j==3)
takeCards[4]++;
}
}
return takeCards;
}
public static void main(String[] args){
final int Nmax=13;
double expectation=0;
int[] takeCards=CaoChongChengXiang2.cccx(Nmax);
System.out.println("Totally "+ (int)Math.pow(Nmax,4) +" selections:");
for(int i=0;i&<=4;i++){
double percentage=(double)takeCards[i]/Math.pow(Nmax,4)*100;
System.out.println("In "+ takeCards[i]+" selections we take "+ i
+ " cards, the percentage is " + (double)Math.round(percentage*1000)/1000 +"% ;");
expectation+=percentage/100*i;
}
System.out.println("The expectation of numbers of card to take is: "+expectation);
}
}
程序運行的結果是:
Totally 28561 selections:
In 1 selections we take 0 cards, the percentage is 0.004% ;
In 5532 selections we take 1 cards, the percentage is 19.369% ;
In 16008 selections we take 2 cards, the percentage is 56.048% ;
In 6525 selections we take 3 cards, the percentage is 22.846% ;
In 495 selections we take 4 cards, the percentage is 1.733% ;
The expectation of numbers of card to take is: 2.0693603165155285
所以我們要求的數學期望是 2.0694 張
實際上,牌堆的牌數並不是無限的,我們需要更準確的模型。
- 假設牌堆里恰好有一副牌(52張)
52張牌,選4張牌,總數是,改一下Java程序,有:
public class CaoChongChengXiang{
public static int[] cccx(int Nmax){ 程序運行的結果是: Totally 270725 selections: 數學期望是 2.0738 張,比理想情況稍大一些。 (這個情況更接近於三國殺牌堆的實際情況) 156張牌,選4張牌,總數是,程序和上面類似,改幾個數字即可。 程序運行的結果是: Totally 23738715 selections: 數學期望是 2.0708 張,介於兩者之間。 ————————————
int[] position={1,2,3,3};
int[] number={1,1,1,1};
int[] takeCards={0,0,0,0,0};
do{
position=nextCom(position,Nmax);
number=positionToNumber(position);
/* judge the numbers of cards to take */
for(int i=0,totalNum=0;i&<4;i++){
if((totalNum+=number[i])&>=13){
takeCards[i]++;
break;
}
if(i==3)
takeCards[4]++;
}
}
while(position[0]&
In 1 selections we take 0 cards, the percentage is 0.000% ;
In 49578 selections we take 1 cards, the percentage is 18.313% ;
In 155470 selections we take 2 cards, the percentage is 57.427% ;
In 61793 selections we take 3 cards, the percentage is 22.825% ;
In 3883 selections we take 4 cards, the percentage is 1.434% ;
The expectation of numbers of card to take is: 2.0737981346384706
In 495 selections we take 0 cards, the percentage is 0.002% ;
In 4516254 selections we take 1 cards, the percentage is 19.025% ;
In 13411722 selections we take 2 cards, the percentage is 56.497%
In 5422479 selections we take 3 cards, the percentage is 22.842% ;
In 387765 selections we take 4 cards, the percentage is 1.633% ;
The expectation of numbers of card to take is: 2.0708026950911202
總結:
我不會算,只是經過實驗得出結論:大概兩張。
所以曹沖遠強於郭嘉,無論哪版曹沖。尤其打2v2,有次對面曹沖、曹昂,真想託管。
推薦閱讀:
※平面幾何添加輔助線證明的原理到底是什麼?
※正17邊形裡面包含著什麼秘密?
※為什麼錢幣要用1,2,5而不是1,2,4或1,3,5之類?
※600人站一排 報數 每次報到奇數的都被殺掉 請問站在哪最安全 怎麼算?
※Flip Game(又名翻轉遊戲、點燈遊戲、滅燈遊戲)的遊戲技巧是什麼?