ZOJ Problem Set - 3374
Recently, a total of 786 girls in Gensokyo sat in a circle, 203 of them were selected as the characters of next Touhou ACT game by draw. Unfortunately, Letty Whiterock didn't win, and she thought it was strange that the nine girls (Reimu, Yukari, Marisa, Alice, Sakuya, Remilia, Youmu, Yuyuko and Sanae) sitting adjacently all won. The expert (proclaimed by herself)
Assume that m girls out of n are selected in eqaul probability, it will be helpful if you can calculate the right probability that there are nine adjacent girls. Remember that the n girls sit in a circle, so the first one is adjacent to the last one.
There are multiple cases. Each cases consists of two integers: 1 ≤ n ≤ 1000 and 1 ≤ m ≤ n.
For each case, output the probability. Answer having an absolute error less than 1e-5 will be accepted. See sample for more details.
10 9 17 15 18 16 786 203
100.000000% 87.500000% 94.117647% 0.263488%
Author: WU, Zejun
Source: ACM × Touhou
Contest: ZOJ Monthly, August 2010