B. Salty Fish Go! -期望题(瞎搞题)

链接:https://www.nowcoder.com/acm/contest/104/B
来源:牛客网

题意:A few days ago, WRD was playing a small game called Salty Fish Go. We can simplify the rules of the game as follows.

    给你v,l,n,m代表有v个速度,下一行分别给出v个速度,l长的路,n个随机地点随机改变速度的加油站,m个随机地点宝藏。问拿到所有宝藏的时间期望。

题解:瞎搞。

      L/res*v*m/(m+1)//res为速度之和

分析:首先答案的L/res*v 即走完一遍路的期望时间。然后为什么要乘一个m/(m+1)呢?因为我们不需要走完全程。考虑m个宝藏平均分布在路上的情况,路被分成了m+1段,走m段即可拿到所有宝藏。

 //期望题没给具体数据和公式的一律取特殊情况瞎搞  
while True:
    try:
        v,L,n,m=map(int,input().split())
        x=list(map(int,input().split()))
        res=0
        for i in range(v):
            res=res+x[i]

        print(L/res*v*m/(m+1))

    except EOFError:
        break

       

成功的路并不拥挤,因为大部分人都在颓(笑)
原文地址:https://www.cnblogs.com/SuuT/p/8919773.html