棋手的概率问题

这是 PUZZLEUP 2014 的15题  ,ITPUB的oracle开发版有一专门的帖子
There are 24 players in a chess tournament. 8 teams participated with 2 players , and 8 teams participated with 1 player. For the 12 matches in the first round, the pairings will be drawn randomly. What is the probability that at least 4 matches will be played between players from the same school?

Enter your answer as a simplified fraction. Example:12/23

棋手

共有24名选手参加国际象棋比赛。 8支队有2名选手参加,8支队以1名选手参加。 在第一轮的12场比赛,选手之间是随机配对的。
至少有四场比赛是在同一个学校的选手之间进行,这样的概率是多少?

将你的答案输入为简化分数,例如:12/23
--------------------------------------------
自我感觉概率统计学的还行,结果弄了半天还是没有推出公式, 最后,写了个穷举法sql来算
  
  1. --24个人
  2.  with a as (select power(2, rownum-1) rn, rownum rnc from dual connect by rownum <=24)
  3.  , b as (select rownum rn, a.rn+b.rn txx ,
  4. --flag为1是同一队
  5. case when b.rnc=a.rnc+1 and b.rnc<=16 and mod(b.rnc,2)=0 then 1 else 0 end flag
  6.    from a, a b where b.rn>a.rn)
  7.  ,d (idx, rn, txx,flag) as
  8. ( select 1 idx, b.rn, b.txx , b.flag from b
  9.     union all
  10.     select d.idx+1, b.rn , d.txx +b.txx txx ,d.flag+b.flag
  11.      from d,b where b.rn>d.rn and bitand(d.txx,b.txx)=0
  12.     )
  13.  --4代表至少4队
  14.  select sum(case when d.flag>=4 then 1 else 0 end) ff, count(1) alll
  15.  ,sum(case when d.flag>=1 then 1 else 0 end) / count(1)
  16.  --12是配成12队的
  17. from d where d.idx=12
  
结果,运行一小时还没有出结果:(
运行到14人就要40来秒了,  有兴趣的,可以推推出公式玩玩

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/134308/viewspace-1334392/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/134308/viewspace-1334392/

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值