#P17259. [ICPC 2017 Urumqi R] Coins

    ID: 16787 Type: RemoteJudge 1000ms 512MiB Tried: 0 Accepted: 0 Difficulty: 6 Uploaded By: Tags>动态规划 DP数学2017概率论期望ICPC

[ICPC 2017 Urumqi R] Coins

题目描述

Alice and Bob are playing a simple game. They line up a row of nn identical coins, all with the heads facing down onto the table and the tails upward.

For exactly mm times they select any kk of the coins and toss them into the air, replacing each of them either heads-up or heads-down with the same possibility. Their purpose is to gain as many coins heads-up as they can.

输入格式

The input has several test cases and the first line contains the integer t(1≤t≤1000)t (1 \le t \le 1000) which is the total number of cases.

For each case, a line contains three space-separated integers nn, m(1≤n,m≤100)m (1 \le n, m \le 100) and k(1≤k≤n)k (1 \le k \le n).

输出格式

For each test case, output the expected number of coins heads-up which you could have at the end under the optimal strategy, as a real number with the precision of 33 digits.

6
2 1 1
2 3 1
5 4 3
6 2 3
6 100 1
6 100 2
0.500
1.250
3.479
3.000
5.500
5.000