• DZY Loves Balls (期望线性性)


       There are n black balls and m white balls in the big box.

    Now, DZY starts to randomly pick out the balls one by one. It forms a sequence S. If at the i-th operation, DZY takes out the black ball, Si=1, otherwise Si=0.

    DZY wants to know the expected times that '01' occurs in S

    .

    InputThe input consists several test cases. (TestCase150)

    The first line contains two integers, n, m(1n,m12)OutputFor each case, output the corresponding result, the format is p/q(p and q are coprime)Sample Input

    1 1
    2 3

    Sample Output

    1/2
    6/5
    
    
            
     

    Hint

    Case 1: S='01' or S='10', so the expected times = 1/2 = 1/2
    Case 2: S='00011' or S='00101' or S='00110' or S='01001' or S='01010' 
    or S='01100' or S='10001' or S='10010' or S='10100' or S='11000',
    so the expected times = (1+2+1+2+2+1+1+1+1+0)/10 = 12/10 = 6/5









    回到题目:

    这个题目中,我们可以定义随机变量Xi为:


    则有:

    X=x1+x2+x3+...

    且,E(xi)=p(xi=1)=(m/m+n)(n/m+n-1)

    则E(X)=E(X1+X2+X3+...X(m+n-1))

    =E(1)+E(2)+...+E(m+n-1)

    =mn/(m+n)

    真的线性性真的牛逼啊







    mn/(m+n)

    。。。。。。。。








  • 相关阅读:
    《重构》读书笔记
    每周总结
    《修改代码的艺术》读书笔记
    每周总结
    每周总结
    《修改代码的艺术》读书笔记
    每周总结
    第二周周总结
    以淘宝网为例,描绘质量属性的六个常见属性场景
    机器学习第八讲
  • 原文地址:https://www.cnblogs.com/zhangbuang/p/10970256.html
Copyright © 2020-2023  润新知