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
hide comments
rv111:
2018-07-11 19:47:19
wikipedia- "expected median value".
|
|
madhur4127:
2017-08-20 18:26:16
what a waste! |
|
manmeet_rana:
2017-07-11 12:02:57
don't think too much(it costed me 1 wa )
|
|
vengatesh15:
2017-02-08 06:19:41
Easy one :-) |
|
dushyant_bgs:
2016-06-24 15:30:00
Just google "Expected Median Value" and compare it with the mean. |
|
akshayjhamb2:
2016-06-09 13:40:32
" Expected Median Value" someone please explain? |
|
akshayvenkat:
2016-06-01 13:48:53
read up "average median value" and write the code :P |
|
vipul_vipul:
2016-04-15 17:04:56
Maths ROXXXX.. |
|
Avi Aryan:
2015-07-17 11:14:02
Easy pattern |
|
Mayank Agarwal:
2015-06-17 14:45:52
what do we mean by Expected Median Value?? |
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 |