Endless Spin

Time Limit: 2000ms
Memory Limit: 32768KB
This problem will be judged on HDU. Original ID: 4624
64-bit integer IO format: %I64d      Java class name: Main

Description

I spin it again and again,and throw it away finally.
So now I have a row of n ball,named from 1 to n,each ball is white initially.
At each step I randomly chose a interval [l, r] and paint all ball in this interval to black.
It means every interval have a equal chance of being chosen.
And I'll stop if all ball are black.What is the expected steps before I stop?

Input

The first line contains integer T(1<=T<=50). Denoting the number of the test cases.
Then T lines follows, each line contains an integer n (1<=n<=50).

Output

For each test cases,print the answer in a line.
Print the answer rounded to 15 decimal places.

Sample Input

3
1
2
3

Sample Output

1.000000000000000
2.000000000000000
2.900000000000000

Source

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .