Re: [閒聊] 1%的抽卡率抽100次機率是63.4%?
※ 引述《sqe123456z (\れをる大好き/)》之銘言:
: 欸不是,我覺得我數學不爛啊
: 雖然我大學讀日文系以後再也沒用到數學了,但是我當年學測也考了14級分欸
: 我剛剛看理科生看到這兩張
: 幹我想了好久都不知道這到底怎麼算出來的
: https://i.imgur.com/pdD98Fk.jpg
: 有沒有人能告訴我計算過程啊?
: 我的理解是手游抽卡,因為沒有限定數量
: 所以不管抽一百次還是一千次,抽中的機率應該都是1%啊
: 靠北我高中數學真的都還給老師了嗎?
: 這到底怎麼算的==
https://imgur.com/fs1T6T9
獻醜
原本想說要用log去算,發現超不準,只好直接算了
怕超過2*32次,就用10次和0.1的機率去算了
至少一次的機率==一次+兩次+...+N(抽的總次數)次
以下程式碼,才正式學C不到10天,請鞭小力點
#include<stdio.h>
#include<math.h>
int cntnis(int a,int b){
int top=1,bottom=1;
for(int i=1;i<=b;i++){
top*=(a-i+1);
bottom*=i;
}
int compute=top/bottom;
return compute;
}
double multi(double have,int havet,int nohavet){
double result=pow(have,havet)*pow((1.0-have),nohavet);
return result;
}
int main(){
int times,cntn,i;
double haveis,mulh,probability,expectation=0;
times=10;
haveis=0.1;
for(i=1;i<=times;i++){
cntn=cntnis(times,i);
mulh=multi(haveis,i,times-i);
probability=cntn*mulh;
printf("抽 %d 次中,抽中 %d 張的機率= %lf\n",times,i,probability);
expectation+=probability*i;
}
printf("抽 %d 次,機率 %.3lf 期望值為: %lf",times,haveis,expectation);
return 0;
}
--
即使祂每天因人們而墮入滾燙的熱水,麵神也不會製造出地獄來懲罰不信仰祂的人
我們崇拜麵神是出於敬佩與感謝,與生前死後諸利益得失皆無任何關係
阿麵~
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 42.75.207.14 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/C_Chat/M.1559575197.A.4F4.html
※ 編輯: fragmentwing (42.75.207.14 臺灣), 06/03/2019 23:22:55
推
06/03 23:25,
4年前
, 1F
06/03 23:25, 1F
推
06/03 23:27,
4年前
, 2F
06/03 23:27, 2F
→
06/03 23:28,
4年前
, 3F
06/03 23:28, 3F
→
06/03 23:28,
4年前
, 4F
06/03 23:28, 4F
→
06/03 23:28,
4年前
, 5F
06/03 23:28, 5F
推
06/03 23:28,
4年前
, 6F
06/03 23:28, 6F
→
06/03 23:28,
4年前
, 7F
06/03 23:28, 7F
→
06/03 23:30,
4年前
, 8F
06/03 23:30, 8F
推
06/03 23:30,
4年前
, 9F
06/03 23:30, 9F
→
06/03 23:33,
4年前
, 10F
06/03 23:33, 10F
推
06/03 23:33,
4年前
, 11F
06/03 23:33, 11F
→
06/03 23:34,
4年前
, 12F
06/03 23:34, 12F
推
06/03 23:36,
4年前
, 13F
06/03 23:36, 13F
→
06/03 23:36,
4年前
, 14F
06/03 23:36, 14F
→
06/03 23:41,
4年前
, 15F
06/03 23:41, 15F
→
06/04 01:10,
4年前
, 16F
06/04 01:10, 16F
推
06/04 01:10,
4年前
, 17F
06/04 01:10, 17F
→
06/04 11:42,
4年前
, 18F
06/04 11:42, 18F
→
06/04 11:45,
4年前
, 19F
06/04 11:45, 19F
推
06/04 13:02,
4年前
, 20F
06/04 13:02, 20F
推
06/04 13:32,
4年前
, 21F
06/04 13:32, 21F
推
06/04 14:04,
4年前
, 22F
06/04 14:04, 22F
討論串 (同標題文章)