码迷,mamicode.com
首页 > 其他好文 > 详细

UVA 11971 - Polygon 数学概率

时间:2016-01-19 19:16:02      阅读:192      评论:0      收藏:0      [点我收藏+]

标签:

                                    Polygon 

John has been given a segment of lenght N, however he needs a polygon. In order to create a polygon
he has cut given segment K times at random positions (uniformly distributed cuts). Now he has K + 1
much shorter segments. What is the probability that he can assemble a polygon using all new segments?
Input
The number of tests T (T ≤ 1000) is given on the ?rst line. T lines follow, each of them contains two
integers N K (1 ≤ N ≤ 106
; 1 ≤ K ≤ 50) described above.
Output
For each test case output a single line ‘Case #T: F’. Where T is the test case number (starting from
1) and F is the result as simple fraction in form of N/D. Please refer to the sample output for clarity.
Sample Input
2
1 1
2 2
Sample Output
Case #1: 0/1
Case #2: 1/4

 

紫书P335

题意:

有一根长度为n的木条,随机选k个位置吧他们切成k+1个小木条。求这些小木条能构成一个多边形的概率

题解:

不难发现这题答案与n无关,在一条直线上切似乎难以处理,可以吧直线接成一个圆,多切一下,即在圆上随机选k+1个点,吧圆切成k+1个线段

除了点x特殊在超过1/2的圆周上,其余K个点都在另一边 , 因此总的概率为 1/(2^k) ,点i取法有k+1种,所有最后答案就是 1 - (k+1)/(2^k).

 

UVA 11971 - Polygon 数学概率

标签:

原文地址:http://www.cnblogs.com/zxhl/p/5142969.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!