题目大意:美女与野兽在玩画鸽子的游戏.鸽子在用黑布遮住的笼子里,白色的有w只,黑色的有b只,每次拿出一只作画,谁先画到白色的鸽子谁就赢.美女首先画,因为野兽太丑,它每次画的时候都会吓跑一只鸽子,所有出笼子的鸽子都不在进去.求美女赢得概率.(设定假如没有人画到白色鸽子,算野兽赢). 题目分析:这道题不难,很显然的概率DP.这是我第一次写概率DP,纪念一下... 代码如下: # include<iostream> # include<cstdio> # include<vecto…
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…
题目大意:一款新游戏注册账号时,有n个用户在排队.每处理一个用户的信息时,可能会出现下面四种情况: 1.处理失败,重新处理,处理信息仍然在队头,发生的概率为p1: 2.处理错误,处理信息到队尾重新排队,发生的概率为p2: 3.处理成功,队头信息处理成功,出队,发生的概率为p3: 4.服务器故障,队伍中所有信息丢失,发生的概率为p4: 小明现在在队伍中的第m个位置,问当他前面的信息条数不超过k-1时服务器故障的概率. 题目分析:这道题的状态转移方程不难写.定义状态dp(i,j)表示在有 i 个人的…
LOOPS Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 125536/65536 K (Java/Others) Total Submission(s): 1864    Accepted Submission(s): 732 Problem Description Akemi Homura is a Mahou Shoujo (Puella Magi/Magical Girl). Homura wants to help h…
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…
D. Bag of mice time limit per test 2 seconds memory limit per test 256 megabytes Promblem 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 danci…
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…
题意:给你w个白色小鼠和b个黑色小鼠,把他们放到袋子里,princess先取,dragon后取,princess取的时候从剩下的当当中任意取一个,dragon取得时候也是从剩下的时候任取一个,但是取完之后会随机跳出来一个.取到每个小鼠的概率是一样的,跳出的也是一样的.先取到白色的小鼠赢,问最后princess能赢的概率. 思路:概率dp,如果把princess能赢的分成两种情况,那么这个题就是递推了,我是用记忆化搜索写的.首先,用dp[i][j]表示袋子当中还有i个白色的,j个黑色的prince…
Collecting Bugs Ivan is fond of collecting. Unlike other people who collect post stamps, coins or other material stuff, he collects software bugs. When Ivan gets a new program, he classifies all possible bugs into n categories. Each day he discovers…
题面 这是我做的第一道概率DP题: 做完后发现没有后效性的DP是真的水: 在这里说主要是再捋顺一下思路: 设f[i][j]表示有i只白鼠,j只黑鼠是获胜的概率: 显然:f[i][0]=1; 然后分四种情况: 1.先手刚好拿到白鼠:概率是i/(i+j); 2.先手拿到黑鼠,后手拿到了白鼠:概率为0: 3.先手拿到了黑鼠,后手拿到了也黑鼠,并且跑的是白鼠:概率是::dp[i][j]=j/(i+j)∗(j−1)/(i+j−1)∗i/(i+j−2)∗dp[i−1][j−2]; 4.先手拿到了黑鼠,后手拿…