CodeForces:148D-D.Bag of mice】的更多相关文章

题目链接 D. Bag of mice time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The dragon and the princess are arguing about what to do on the New Year's Eve. The dragon suggests flying to the mounta…
http://codeforces.com/problemset/problem/148/D (题目链接) 题意 包中有w个白鼠,b个黑鼠.公主和龙轮流画老鼠,公主先画,谁先画到白鼠谁就赢.龙每画完一只老鼠,就会有另一只老鼠从包中跑出来.每只老鼠被画到以及跑出的概率相等,问公主获胜的概率. Solution 令${f_{0/1,i,j}}$表示此时公主/龙选,包中还剩i只白鼠,j只黑鼠,公主赢的概率.那么转移很显然: $${f_{0,i,j}=\frac{i}{i+j}+\frac{j}{i+j…
概率DP kuangbin总结中的第9题 啊……题目给的数据只有白鼠和黑鼠的数量,所以我们只能在这个上面做(gao)文(D)章(P)了…… 明显可以用两种老鼠的数量来作为状态= = 我的WA做法: 令f[i][j]表示从(w,b)轮流取老鼠一直到(i,j)[此时轮process取]两人一直不分胜负的概率,很明显(i,j)这个状态下赢的概率为 i / (i+j) ,那么总共赢的概率就是对所有(i,j),f[i][j]*i/(i+j)求和 转移当然很简单啦~ f[i][j]只可能从f[i][j+3]…
The dragon and the princess are arguing about what to do on the New Year's Eve. The dragon suggests flying to the mountains to watch fairies dancing in the moonlight, while the princess thinks they should just go to bed early. They are desperate to c…
http://codeforces.com/contest/148/problem/D 题目意思是龙和公主轮流从袋子里抽老鼠.袋子里有白老师 W 仅仅.黑老师 D 仅仅.公主先抽,第一个抽出白老鼠的胜利,龙每次抽的时候会随机跑出一仅仅老鼠.给出W和D要你求出公主胜利的概率. 对于dp[w][d]表示有w仅仅白老鼠d仅仅黑老鼠的情况下公主胜利的概率,假设公主第一次就抽出白鼠,概率是 w/(w+d) .而假设公主没有抽到白鼠,要让公主胜利,龙也不能抽到白鼠.则是 rec = d/(w+d) * (d…
除非特别忙,我接下来会尽可能翻译我做的每道CF题的题面! Codeforces 148D 一袋老鼠 Bag of mice | 概率DP 水题 题面 胡小兔和司公子都认为对方是垃圾. 为了决出谁才是垃圾,大哥拿来了一袋老鼠,其中有w只白老鼠和b只黑老鼠.胡小兔先抓,先抓到白老鼠的人赢. 每次学姐抓完老鼠之后,总会有另外一只老鼠从袋子里自己跑出来(这只老鼠不算任何人抓的),而胡小兔抓老鼠时则不会发生这样的事. 每次袋子里的每只老鼠被抓到的概率相等,当有一只老鼠跑出来的时候,每只老鼠跑出来的几率也相…
D. Bag of mice time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The dragon and the princess are arguing about what to do on the New Year's Eve. The dragon suggests flying to the mountains t…
Bag of mice time limit per test 2 seconds memory limit per test 256 megabytes Program Description The dragon and the princess are arguing about what to do on the New Year's Eve. The dragon suggests flying to the mountains to watch fairies dancing in…
题目链接: http://codeforces.com/problemset/problem/148/D D. Bag of mice time limit per test2 secondsmemory limit per test256 megabytes 问题描述 The dragon and the princess are arguing about what to do on the New Year's Eve. The dragon suggests flying to the…
D. Bag of mice http://codeforces.com/problemset/problem/148/D time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The dragon and the princess are arguing about what to do on the New Year's Eve…