题目大意:
袋子里有N个黑球、M个白球。用1表示取出来的是黑球,0表示取出来的是白球。不放回
的从袋子里取出这N+M个球。求相邻取出的两个球第一个球白球,第二个球是黑球的期望
次数是多少,即出现"01"的期望次数是多少。
思路:
考虑期望可加。第i(1<=i<=N+M)个位置上出现白球的概率为M/(M+N),则i+1个位置上
出现黑球的概率为N/(M+N-1)。因为白球只能在1~M+N-1个位置上出现(后边还有黑球)。
所以出现"01"的次数为(M+n-1)次。则总的期望 = M/(M+N...
分类:
其他好文 时间:
2015-04-24 21:10:31
阅读次数:
156
Description
Alexander Charles McMillan loves to gamble, and during his last trip to the casino he ran across a new game. It is played on a linear sequence of squares as shown below.
A chip is...
分类:
其他好文 时间:
2015-04-23 23:30:27
阅读次数:
290
DZY Loves Topological SortingTime Limit: 1 SecMemory Limit: 256 MB题目连接http://acm.hdu.edu.cn/showproblem.php?pid=5195DescriptionA topological sort or t...
分类:
编程语言 时间:
2015-04-22 00:18:43
阅读次数:
203
题意:给出一列数,在这个序列里面找到一个连续的严格上升的子串,现在可以任意修改序列里面的一个数,问得到的子串最长是多少看的题解,自己没有想出来假设修改的是a[i],那么有三种情况,1.a[i]>a[i-1],那么求出向左能够延伸的最长的长度2.a[i] 2 #include 3 #inclu...
分类:
其他好文 时间:
2015-04-16 21:21:24
阅读次数:
117
题意:给出n*m的棋盘,在‘.’处放上B或者W,最后要求所有的B和W都不相邻先把棋盘的点转化成‘B’,再搜,如果它的四周存在‘B’,则将它变成'W'一直挂在第五个数据的原因是,没有dfs(nx,ny)搜索果断弱爆了= =(差不多写了一个小时) 1 #include 2 #include 3 ...
分类:
其他好文 时间:
2015-04-16 21:15:48
阅读次数:
129
Problem Description:
There are n
black balls and m
white balls in the big box.
Now, DZY starts to randomly pick out the balls one by one. It forms a sequence
S.
If at the i-th
operation,...
分类:
其他好文 时间:
2015-04-16 09:09:31
阅读次数:
174
E. Roland and RoseTime Limit: 1 SecMemory Limit: 256 MB题目连接http://codeforces.com/problemset/problem/460/EDescriptionRoland loves growing flowers. He h...
分类:
其他好文 时间:
2015-04-15 00:58:03
阅读次数:
207
D. Little Girl and Maximum XOR
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers
l and r. Let's consider the values of
for all pa...
分类:
其他好文 时间:
2015-04-10 09:40:40
阅读次数:
147
Little penguin Polo loves his home village. The village has n houses, indexed by integers from 1 to n. Each house has a plaque containing an integer, the i-th house has a plaque containing integer pi (...
分类:
其他好文 时间:
2015-04-09 09:04:20
阅读次数:
177
/*
充分利用了菲波那切数列的两条定理:
①定义F[1] = a, F[2] = b, F[n] = F[n - 1] + F[n - 2](n≥3)。
有F[n] = b * fib[n - 1] + a * fib[n - 2](n≥3),其中fib[i]为斐波那契数列的第 i 项。
②定义F[1] = a, F[2] = b, F[n] = F[n -...
分类:
其他好文 时间:
2015-04-08 18:12:38
阅读次数:
116