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 first 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).