Problem description
小明在班里一直是个很公正的孩子,这点同学和老师都很清楚,这不,老师每周都会从家里带来一些糖果,然后叫小明把糖果分给其他小朋友,但这个班里的同学都有一个很特别的性格,就是他们只喜欢偶数,对于糖果也一样,所以小明在分糖果时也必须要保证这一点,即使每个同学分的糖果数量不一样。都是奇怪的是,小明有时候并不能够合格的分糖果,这让他大为苦恼,害怕别的同学会...
分类:
其他好文 时间:
2015-06-07 20:17:13
阅读次数:
166
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个孩子站成一排,每个人分给一个权重。按照如下的规则分配糖果:
每个孩子至少有一个糖果权重较高的孩子,会比他的邻居获得更多的糖果。
问题是,最少需要多少个糖果?...
分类:
编程语言 时间:
2015-05-13 10:30:05
阅读次数:
325
注意题意是开始两个盒子各有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