1626 - Cutting rope
Time Limit : 1 Second
Memory Limit : 128 MB
Submission: 51
Solved: 35
- Description
- Inside a rope of length n, n-1 points are placed with distance 1 from each other and from the endpoints. Among these points, we choose m-1 points at random and cut the rope at these points to create m segments.
Let E(n, m) be the expected length of the shortest segment. Give n and m, find E(n, m).
Give your answer rounded to 5 decimal places behind the decimal point.
- Input
- The first line of input will be a positive integer T indicating how many data sets will be included. Each of the next T lines will contain two integers n, m (1 ≤ n, m ≤ 100000; m ≤ n) as mentioned before.
- Output
- For each test case, output E(n, m) rounded to 5 decimal places behind the decimal point in separate line.
- sample input
-
3 2 2 4 2 100 10
- sample output
-
1.00000 1.33333 1.52740
- hint
- source
- The 8th(2013) ACM Programming Contest of HUST