题意:有两个箱子,里面各放有糖n个,每天从两个之中任取一颗糖,突然有一天小孩取糖时发现一个盒子里空了,问另一个盒子里面现在有多少糖(求期望值)?
#include
#include
using namespace std;
double F[400008];
double C_N_M(int n,int m)
{
return F[n]-F[m]-F[n-m];
}
void Ini...
分类:
其他好文 时间:
2015-06-09 10:00:26
阅读次数:
542
CREATE TABLE CANDY_TBL SELECT * FROM PRODUCTS_TBL;INSERT INTO CANDY_TBL VALUES ('9', 'CANDY CORN', 1.35);SELECT * FROM CANDY_TBL;+---------+----------...
分类:
其他好文 时间:
2015-05-30 00:31:29
阅读次数:
157
Candy Sharing Game
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 3703 Accepted Submission(s): 2311
Problem Description
A numbe...
分类:
编程语言 时间:
2015-05-29 23:23:16
阅读次数:
387
There are N children standing in a line. Each child is assigned a rating value.
You are giving candies to these children subjected to the following requirements:
Each child must have at least on...
分类:
其他好文 时间:
2015-05-29 18:18:54
阅读次数:
115
Problem DescriptionA number of students sit in a circle facing their teacher in the center. Each student initially has an even number of pieces of can...
分类:
其他好文 时间:
2015-05-22 00:23:25
阅读次数:
125
题目描述:
There are N children standing in a line. Each child is assigned a rating value.
You are giving candies to these children subjected to the following requirements:
Each child must have ...
分类:
其他好文 时间:
2015-05-19 16:37:14
阅读次数:
190
Children of the Candy Corn
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 10739
Accepted: 4626
Description
The cornfield maze is a popular Halloween treat. ...
分类:
其他好文 时间:
2015-05-16 14:58:36
阅读次数:
139
1639 - CandyTime limit: 3.000 seconds1639 CandyLazyChild is a lazy child who likes candy very much. Despite being very young, he has two large candy b...
分类:
其他好文 时间:
2015-05-14 23:27:49
阅读次数:
215
注意题意是开始两个盒子各有n个糖果,等吃完就只有两种情况,盒子1没了,或者盒子2没了。
这完全是个求概率期望的数学问题。借用二项分布公式:
P(ξ=K)= C(n,k) * p^k * (1-p)^(n-k), 其中C(n, k) = n!/(k! * (n-k)!)注意!:第二个等号后面的括号里的是上标,表示的是方幂。
得出第i次打开盒子1没糖的概率C(2n-1,n)p^(n+1)(1...
分类:
其他好文 时间:
2015-05-08 11:03:17
阅读次数:
219
题意:给出一个矩形的三种操作,顺时针旋转,逆时针旋转,对称,给出原始坐标,再给出操作数,问最后得到的坐标画一下模拟一下操作就可以找到规律了 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #incl...
分类:
其他好文 时间:
2015-05-05 15:54:30
阅读次数:
128