题解 | #钓鱼比赛#

钓鱼比赛

https://www.nowcoder.com/practice/cac8bc877bbd444c8999d7fd77e5dd89

while True:
    try:
        n, m, x, y, t = list(map(int, input().strip().split()))
        matrix = []
        prob_sum = 0.0
        for i in range(n):
            matrix.append(list(map(float, input().strip().split())))
            prob_sum += sum(matrix[-1])
        cc = matrix[x-1][y-1]
        cc_win = 1 - (1-cc)**t
        ss = prob_sum/(n*m)
        ss_win = 1 - (1-ss)**t
        if cc == ss:
            print("equal")
            print("{:.2f}".format(cc_win))
        elif cc > ss:
            print("cc")
            print("{:.2f}".format(cc_win))
        else:
            print("ss")
            print("{:.2f}".format(ss_win))
    except:
        break

P(钓到大于等于一条鱼)=1-P(一直钓不到鱼)=1-(1-P(钓到鱼))**t

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务