概率dp - UVA 11021 Tribles
Tribles
Problem's Link: http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=33059
Mean:
有k个细菌,每个细菌只能存活一天,在死去之前可能会分裂出0,1,2....n-1个细菌,对应的概率为p0,p1,p2....pn-1。
问:所有细菌在第m天全部灭亡的概率是多少?(m天以前灭亡也算在内)
analyse:
由于每一个细菌的生存是独立的,所以我们可以先算出一个细菌的概率为PP,最终答案应是:PP^k。
设dp[i]表示第i天全部灭亡的概率,那么:
dp[i] = p0*(dp[i-1]^0) + p1*(dp[i-1]^1) + p2*(dp[i-1]^2) + ...pn-1*(dp[i-1]^(n-1))
其中pi*(dp[j-1]^i)表示:该细菌分裂成了i个,这i个细菌在第j-1天灭亡的概率。
由于每个细菌独立,所以是乘法,也就是i次方。
对于dp[0],代表第0天就全部灭亡,也就是根本没有分裂,所以dp[0]=p0.
Time complexity: O(N)
Source code:
);
;;;;;
}
/*
*/
概率dp - UVA 11021 Tribles的更多相关文章
- UVA 11021 - Tribles(概率递推)
UVA 11021 - Tribles 题目链接 题意:k个毛球,每一个毛球死后会产生i个毛球的概率为pi.问m天后,全部毛球都死亡的概率 思路:f[i]为一个毛球第i天死亡的概率.那么 f(i)=p ...
- UVA - 11021 Tribles 概率dp
题目链接: http://vjudge.net/problem/UVA-11021 Tribles Time Limit: 3000MS 题意 有k只麻球,每只活一天就会死亡,临死之前可能会出生一些新 ...
- UVa 11021 Tribles (概率DP + 组合数学)
题意:有 k 只小鸟,每只都只能活一天,但是每只都可以生出一些新的小鸟,生出 i 个小鸟的概率是 Pi,问你 m 天所有的小鸟都死亡的概率是多少. 析:先考虑只有一只小鸟,dp[i] 表示 i 天全部 ...
- UVA 11021 - Tribles(概率)
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=481&page=s ...
- UVA 11021 Tribles(递推+概率)
题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=33059 [思路] 递推+概率. 设f[i]表示一只Tribble经 ...
- UVA - 11021 - Tribles 递推概率
GRAVITATION, n.“The tendency of all bodies to approach one another with a strengthproportion to the ...
- UVa 11021 - Tribles
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...
- 概率dp - Uva 10900 So you want to be a 2n-aire?
So you want to be a 2n-aire? Problem's Link Mean: 玩一个答题赢奖金的游戏,一开始有1块钱,玩n次,每次赢的概率为t~1之间的某个实数. 给定n和t,求 ...
- UVA11021 Tribles[离散概率 DP]
UVA - 11021 Tribles GRAVITATION, n. “The tendency of all bodies to approach one another with a stren ...
随机推荐
- Android Service+Socket 联网交互
android中,联网操作有http连接和socket连接两大类.由于项目需要,我们采取的是Socket连接.鉴于平时连接频繁,因此把Socket连接放到Service里,需要从服务器端获取数据时,只 ...
- 【转】如何成为Python高手
http://www.aqee.net/how-to-become-a-proficient-python-programmer/ 这篇文章主要是对我收集的一些文章的摘要.因为已经有很多比我有才华的人 ...
- HDoj-2095-与众不同
Problem Description In the new year party, everybody will get a "special present".Now it's ...
- element-ui 源码学习
https://athena0304.github.io/element-analysis/ 1.模板字符串实现字符串拼接 typeClass() { return `el-alert--${ thi ...
- webpack CommonsChunkPlugin 提取公共代码
1.项目结构 2.部分代码 module.js console.log('module.js'); index文件夹下的index.js require('../module.js'); consol ...
- chrome 禁止自动更新
禁止chrome自动更新 CreateTime--2017年7月4日09:07:01Author:Marydon 版本号:59.0.3071.115 x64 第一步:禁止Google更新服务 参考 ...
- java反射--方法反射的基本操作
方法的反射 1)如何获取某个方法 方法的名称和方法的参数列表才能唯一决定某个方法. 2)方法反射的操作 method.invoke(对象,参数列表). 代码实例: package com.reflec ...
- Apache Ant和Apache Maven的区别
Apache Ant和Apache Maven的区别 分类: ANT Maven 2013-12-10 18:47 1477人阅读 评论(26) 收藏 举报 ———摘自<maven权威指南> ...
- C#拼接SQL中in条件
一.拼接字符串类型的字段 string sql = @"select distinct ziduan from tablename where ziduan in ('{0}')" ...
- python --标准库 路径与文件 (os.path包, glob包)
os.path包 os.path包主要是处理路径字符串,提取出有用信息. #coding:utf-8 import os.path path = 'D:\\Python7\\test\\data.tx ...