>>931
2.のシミュレーション解

bag=rep(1:0,c(6,4))
sim <- function(x) sum(sample(bag,5))
re=replicate(1e6,sim())
table(re)/1e6

1 2 3 4 5
0.024026 0.237994 0.476124 0.238167 0.023689