
ZOJ Problem Set  2949
Luck is the key to life. When I have to decide something, I will make my decision by flipping a coin. And then, I have two things to do. First, I have the decision made. Second, I go to the nearest church and donate the coin. But there are always too many things I have to decide. For example, what should I eat today for lunch? OK, now we are talking about a decision, so let us assume that I have two kinds of food: quickserved noodle A and quickserved noodle B. I just have bought N bowls of noodle A and N bowls of noodle B. If I have some space to make a decision (i.e. having two kinds of quickserved noodle to choose from), then I will flip a coin to decide which kind of noodle to eat. My question is, before I eat up all 2 * N bowls of quickserved noodle, what is the mathematical expectation of the number of coins I will have to donate. Input Standard input will contain multiple test cases. The first line of the input is a single integer T (1 <= T <= 1000) which is the number of test cases. And it will be followed by T consecutive test cases. Each test case contains an integer N (1 <= N <= 1000). Output Results should be directed to standard output. The output of each test case should be a single real number, which is the mathematical expectation of the number of coins I have to donate. The result should be accurate to two digits after the fractional point.Sample Input 2 1 2 Sample Output 1.00 2.50 Author: CHEN, Zhengguang Source: Zhejiang University Local Contest 2008 