Random Pair

All submissions for this problem are available.
Read problems statements in Russian and Vietnamese as well.
Chefu is Chef's little brother, he is 12 years old and he is new to competitive programming.
Chefu is practicing very hard to become a very skilled competitive programmer and win gold medal in IOI.
Now Chefu is participating in a contest and the problem that he is trying to solve states:
Given an array A of N integers, find any i, j such that i < j and A_{i} + A_{j} is maximum possible
unfortunately, there's no much time left before the end of the contest, so Chefu doesn't have time to think of correct solution, so instead, he wrote a solution that selects a random pair (i, j) (i < j) and output A_{i} + A_{j}. each pair is equiprobable to be selected.
Now Chefu wants your help to calculate the probability that his solution will pass a particular input.
Input
First line contains an integer T denoting the number of testcases.
First line of each testcase contains a single integer N
Second line of each testcase contains N spaceseparated integers A_{1} A_{2} ... A_{N}
Output
For each testcase output a single line containing a single number denoting the probability that Chefu's solution to output a correct answer. your answer will be accepted if the absolute difference between it and correct answer is less than 1e6
Constraints
Example
Input: 3 4 3 3 3 3 6 1 1 1 2 2 2 4 1 2 2 3 Output: 1.00000000 0.20000000 0.33333333
Author:  kingofnumbers 
Tester:  amrmahmoud 
Editorial  https://discuss.codechef.com/problems/RNDPAIR 
Tags  cakewalk, cook88, kingofnumbers, kingofnumbers, likecs, probability 
Date Added:  18112017 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.5, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, CLOJ, COB, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 