SP17400 DCEPC12H - Height of Expectation
Description
Welcome To ICPC! ICPC is a programming competition in which N teams participate every year. Out of N teams, K number of teams has been selected from our college. You know what? K is always a prime number. Coincidence! Before going to ICPC, we want to calculate our expected overall score of our college.
Expected Overall score is defined as expected median value of our college team’s ranks.
All the ranks are distinct. Team’s rank value always lies between 1 to N.
Input Format
First line consists of T, the number of test cases.
Each of the next T lines contains 2 space separated integers N and K.
Output Format
Output T lines each line containing expected overall score of our college. You should output at least 6 digits after decimal.