zoukankan      html  css  js  c++  java
  • 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)

    。。。。。。。。








  • 相关阅读:
    Chrome控制台JS设置xpath定位
    logging.exception
    python去除换行和空格
    从剪切板获取的内容无法使用type函数得到数据类型
    python获取剪切板的内容
    hdoj Radar Installation
    hdoj- Windows Message Queue
    hdoj-看病要排队
    hdoj-1896 stones
    评委会打分
  • 原文地址:https://www.cnblogs.com/zhangbuang/p/10970256.html
Copyright © 2011-2022 走看看