Dice
题号:NC54735
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

The dice game is very common in movies. Briefly, the rule is that you need to bet on your choice, and the probability of winning is one-half. If you win, your money will get doubled, otherwise you will lose your money in this round.
One day, Tom came up with a brilliant strategy to make sure he wouldn't lose much money. The steps of the strategy are described as following:
1. He would play n rounds of the dice game at most.
2. Start betting with 1 dollar in the first round, and double the bet every round.
3. If he won the game in a round, he would not take part in all the following games.
Now Tom wants to know the probability of his winning the money using this strategy after the game.

输入描述:

The first line contains a number t(t<=20) indicating that there are t test cases.

The next t lines contain a number n(n<=20) each, indicating that the maximum round Tom would play

输出描述:

Please output the probability that Tom will make money.(Reserved to four decimal places)
示例1

输入

复制
2
1
2

输出

复制
0.5000
0.7500

说明

In the first test case, n equals to 1.  The probability of wining and losing are equal, so the probability of winning at the first time is 0.5000.

In the second test case, n equals to 2. The probability of wining and losing are equal, so the probability of winning at the first time is 0.5000. When lose the game at the first time, the probability of winning at the second time is 0.5000. Therefore the probability that Tom will make money equal to 0.5000 + 0.5000 * 0.5000 = 0.7500

备注:

Hint:Please use double instead of float