King Arthur's Birthday Celebration】的更多相关文章

C - King Arthur's Birthday Celebration POJ - 3682 King Arthur is an narcissist who intends to spare no coins to celebrate his coming K-th birthday. The luxurious celebration will start on his birthday and King Arthur decides to let fate tell when to…
King Arthur is an narcissist who intends to spare no coins to celebrate his coming K-th birthday. The luxurious celebration will start on his birthday and King Arthur decides to let fate tell when to stop it. Every day he will toss a coin which has p…
题意:进行翻硬币实验,若k次向上则结束,进行第n次实验需花费2*n-1的费用,询问期望结束次数及期望结束费用 设F[i]为第i次结束时的概率 F[i]=  c(i-1,k-1)*p^k*(1-p)^(i-k) sigma(f[i])==1 p^k*sigma(c(i-1,k-1)*(1-p)^(i-k))=1 sigma(c(i-1,k-1)*(1-p)^(i-k))=1/(p^k) ans1=sigma(i*f[i]) =p^k*sigma(i*c(i-1,k-1)*(1-p)^(i-k))…
每天抛一个硬币,硬币正面朝上的几率是p,直到抛出k次正面为止结束,第一天抛硬币需花费1,第二天花费3,然后是5,7,9……以此类推,让我们求出抛硬币的天数的期望和花费的期望. 天数期望: A.投出了k-1个硬币正面朝上花费了E(k-1)天,再投出一个硬币正面朝上(概率为p,花费时间+1天):B.投出了k个硬币正面朝上花费了E(k)天,投出一个硬币反面朝上(概率为1-p,花费时间+1天).分析的时候不能漏掉B情况,得到关系式:E(k)=p*(E(k-1)+1)+(1-p)*(E(k)+1),整理可…
传送门 题意 进行翻硬币实验,若k次向上则结束,进行第n次实验需花费2*n-1的费用,询问期望结束次数及期望结束费用 分析 我们令f[i]为结束概率 \[f[i]=C_{i-1}^{k-1}*p^k*(1-p)^{i-k}\] \[\sum f[i]=1(关键)\] \(ans1=\sum f[i]\) \(=\sum i*C_{i-1}^{k-1}*p^k*(1-p)^{i-k}\) \(=p^k*k*\sum C_i^k*(1-p)^{i-k}\) \(=k/p\) \(ans2=\sum…
也许更好的阅读体验 \(\mathcal{Description}\) 每天抛一个硬币,硬币正面朝上的几率是p,直到抛出k次正面为止结束,第\(i\)天抛硬币的花费为\(2i-1\),求出抛硬币的天数的期望和花费的期望. \(\mathcal{Solution}\) 该题为双倍经验题,具体做法请看 收集邮票 (原谅我的懒惰,但这可以认为是一样的题了) 这里我们求\(f\)数组的过程将概率改为\(p\),求\(g\)时,将里面的\(f[i]\)与\(f[i+1]\)全部乘以2即可 注意 本题输出有…
传送门 解题思路 第一问比较简单,设$f[i]​$表示扔了$i​$次正面向上的硬币的期望,那么有转移方程 : $f[i]=f[i]*(1-p)+f[i-1]*p+1​$,意思就是$i​$次正面向上可以由$i-1​$次扔一个正面或者$i​$次扔一个背面得到,化简后可得 : $f[i]=f[i-1]+1/p​$. 第二问就比较玄学了,设$g[i]$表示扔了$i$次正面向上花费的期望,那么考虑如果第$i$次到正面,其实次数等于$f[i-1]+1$,如果扔到背面,次数等于$f[i]+1$.所以转移方程:…
King Arthur is an narcissist who intends to spare no coins to celebrate his coming K-th birthday. The luxurious celebration will start on his birthday and King Arthur decides to let fate tell when to stop it. Every day he will toss a coin which has p…
King Arthur's Knights Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1415 Accepted Submission(s): 612 Special Judge Problem Description I am the bone of my sword. Steel is my body, and the fire i…
King Arthur's KnightsTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2752    Accepted Submission(s): 1086Special Judge Problem DescriptionI am the bone of my sword. Steel is my body, and the fir…