概率dp方法及实例

欢迎访问https://blog.csdn.net/lxt_Lucia~~

宇宙第一小仙女\(^o^)/~~萌量爆表求带飞=≡Σ((( つ^o^)つ~ dalao们点个关注呗~~

 

摘要

 

概率DP主要用于求解期望概率等题目,其实和高中概率题的求法也有许多相似之处,能用高中数学知识解决的完全可以用高  中思路直接解决,除此以外,也可以用动态规划求解转移方程,还可以用迭代的方式,有时候就需要比较灵活地运用了。

因此,咱们做概率题的优先考虑顺序为:

1)高中数学直接解决

2)动态规划求解转移方程

3)迭代法

一般来说:求概率是正推,求期望是逆推,通过题目可以体会到这点。

 

 

下面让我们来举几个栗子具体感受下叭~

 

 

实例

 

例1:Discovering Gold LightOj : 1030 

 

Description

You probably have played the game "Throwing Balls into the Basket". It is a simple game. You have to throw a ball into a basket from a certain distance. One day we (the AIUB ACMMER) were playing the game. But it was slightly different from the main game. In our game we were Npeople trying to throw balls into identical Baskets. At each turn we all were selecting a basket and trying to throw a ball into it. After the game we saw exactly S balls were successful. Now you will be given the value of and M. For each player probability of throwing a ball into any basket successfully is P. Assume that there are infinitely many balls and the probability of choosing a basket by any player is 1/M. If multiple people choose a common basket and throw their ball, you can assume that their balls will not conflict, and the probability remains same for getting inside a basket. You have to find the expected number of balls entered into the baskets after turns.

Input

Input starts with an integer T (≤ 100), denoting the number of test cases.

Each case starts with a line containing three integers N (1 ≤ N ≤ 16), M (1 ≤ M ≤ 100) andK (0 ≤ K ≤ 100) and a real number P (0  P ≤ 1)P contains at most three places after the decimal point.

Output

For each case, print the case number and the expected number of balls. Errors less than 10-6will be ignored.

Sample Input

2

1 1 1 0.5

1 1 2 0.5

Sample Output

Case 1: 0.5

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值