## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

## Too Mean CodeChef Solution | CodeChef Problem Solution 2022

You are given an array $A$ of length $N$.

You have to partition the elements of the array into some subsequences such that:

• Each element ${A}_{i}$ $\left(1\le i\le N\right)$ belongs to exactly one subsequence.
• The mean of the mean of subsequences is maximised.

Formally, let ${S}_{1},{S}_{2},\dots ,{S}_{K}$ denote $K$ subsequences of array $A$ such that each element ${A}_{i}$ $\left(1\le i\le N\right)$ belongs to exactly one subsequence ${S}_{j}$ $\left(1\le j\le K\right)$.
Let ${X}_{j}$ $\left(1\le j\le K\right)$ denote the mean of the elements of subsequence ${S}_{j}$. You need to maximise the value $\frac{\sum _{j=1}^{K}{X}_{j}}{K}$.

Print the maximum value. The answer is considered correct if the relative error is less than ${10}^{-6}$.

### Input Format

• First line will contain $T$, number of test cases. Then the test cases follow.
• First line of each test case consists of a single integer $N$ - denoting the length of array $A$.
• Second line of each test case consists of $N$ space-separated integers ${A}_{1},{A}_{2},\dots ,{A}_{N}$ - denoting the array $A$.

### Output Format

For each test case, output in a single line, the maximum possible mean of mean of subsequences. The answer is considered correct if the relative error is less than ${10}^{-6}$.

### Constraints

• $1\le T\le 1000$
• $2\le N\le {10}^{5}$
• $1\le {A}_{i}\le {10}^{6}$
• Sum of $N$ over all test cases does not exceed $3\cdot {10}^{5}$.

### Sample Input 1

3
2
10 20
3
1 2 3
5
50 50 50 50 50


### Sample Output 1

15
2.25
50


### Explanation

Test Case $1$: We can partition the array in $2$ ways - $\left(\left\{10\right\},\left\{20\right\}\right)$ or $\left(\left\{10,20\right\}\right)$. In both cases, mean of mean of subsequences comes out to be $15$.

Test Case $2$: The optimal partition is $\left(\left\{1,2\right\},\left\{3\right\}\right)$.

• Mean of first subsequence $=\frac{1+2}{2}=1.5$.
• Mean of second subsequence $=\frac{3}{1}=3$.

Thus, mean of mean of subsequences is $\frac{1.5+3}{2}=\frac{4.5}{2}=2.25$.

Test Case $3$: Any partition will yield the mean of mean of subsequences as $50$.