SP14697 LOOPEXP - Loop Expectation
Description
Consider the following pseudo-code
int a\[1..N\];
int max = -1;
for i = 1..N:
if(a\[i\] > max)
max = a\[i\];
Your task is to calculate the expected number of times the 'if' block of the above pseudo-code executes. The array 'a' is a random permutation of numbers from 1..N chosen uniformly at random.
Input Format
First line contains t, the number of test cases. t lines follow, each containing N, the number of elements in the array.
1
Output Format
For each test case, output a single decimal. Your answer should be within 10^-6 of the correct answer.