博客
关于我
【Lintcode】266. Expect Distance
阅读量:214 次
发布时间:2019-02-28

本文共 304 字,大约阅读时间需要 1 分钟。

从山洞A出发,有两条路。一条路走x千米,回到A;另一条路走2千米,到达B。从B出发,也有两条路。一条路走y千米,回到A;另一条路走z千米,到达出口C。我们需要计算从A出发走出C的期望路程。

设E[X]为从A出发走出C的期望路程,E[Y]为从B出发走出C的期望路程。根据条件期望公式,可以建立以下方程:

  • 从A出发:E[X] = 1/2 (x + E[X]) + 1/2 (2 + E[Y])

  • 从B出发:E[Y] = 1/2 (y + E[X]) + 1/2 z

  • 通过解这两个方程,可以得到:

    E[X] = 2x + y + z + 4

    因此,从山洞A出发走出C的期望路程为:

    2x + y + z + 4 千米

    转载地址:http://txcs.baihongyu.com/

    你可能感兴趣的文章
    Prometheus 云原生 - 监控 Linux、MySQL、Redis、RabbitMQ、Docker、SpringBoot 3.x
    查看>>
    Prometheus 介绍
    查看>>
    Prometheus 安全配置详解
    查看>>
    prometheus 安装node_exporter, node_exporter 安装最新版 普罗米修思安装监控服务器client
    查看>>
    Prometheus 安装部署实战
    查看>>
    prometheus 持久化存储方案
    查看>>
    Prometheus 监控系统企业级实战
    查看>>
    Prometheus 监控系统简介
    查看>>
    Prometheus 配置详解
    查看>>
    Prometheus 采集器使用详解
    查看>>
    Prometheus 黑盒监控实战
    查看>>
    prometheus+alertmanager+grafana监控部署教程
    查看>>
    Prometheus+Grafana构建智能化Kubernetes监控系统实战
    查看>>
    Prometheus+SpringBoot应用监控全过程详解
    查看>>
    Prometheus+SpringBoot应用监控全过程详解
    查看>>
    prometheus安装
    查看>>
    Prometheus实战教程:监控Kafka消息
    查看>>
    Prometheus实战教程:监控mysql数据库
    查看>>
    Prometheus实战教程:监控Nginx状态
    查看>>
    prometheus常用exporter下载地址大全
    查看>>