Submit | All submissions | Best solutions | Back to list |
DCEPC12H - Height of Expectation |
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
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
Output T lines each line containing expected overall score of our college. You should output at least 6 digits after decimal.
Constraints
1<=T<=500
1<=N<=100
1<=K<=10
N>=K
Example
Input: 1 3 3 Output: 2.0000000
Added by: | dce coders |
Date: | 2013-12-07 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | C CSHARP C++ 4.3.2 CPP C99 HASK JAVA PAS-GPC PAS-FPC PYTHON PYTHON3 PY_NBC |
hide comments
|
|||||
2014-12-28 16:26:26 Anand
easy one :) Pattern :D |
|||||
2014-05-07 14:21:27 Flago
I almost didn't submitted as my answer seemed too easy :D |
|||||
2014-04-01 20:43:15 SanchitK
please someone give a test case when n>10 |