All Submissions


There is this PRO in our batch named Raghvesh. He is well known for his DANGEROUS PJ's. Dude, when i say DANGEROUS i really mean it. You won't wanna hear any of those. Unfortunately, we in our circle have to handle those every day.

One day Shikhar Sharad got an idea to end it for once and all. He framed a challenge which if Raghvesh loses, he would swear not to do KC with any of his PJ's ever again. As Shikhar knew, Raghvesh loves Maths a lot :P, so he decided to pose a mathematical challenge. He placed N coins on the table with all heads up. Then he wrote K numbers on a piece of paper. ith number refers to the number of coins Raghvesh can randomly choose and reverse them upside down in the ith round. So, Raghvesh has to tell expected number of heads after K rounds.

Now the thing is that there is a timer of 2 minutes. If Raghvesh gives the answer to the puzzle within 2 minutes he wins otherwise he loses. But, he would not accept his defeat if Shikhar also cant answer the puzzle within the same stipulated time. Help Shikhar and all of us from Raghvesh's deadly jokes.

Input:
The first line of input is the number of test cases T. Each test case begins with an integer N, the number of coins. The next line contains the integer K, the number of rounds. The last line of the test case contains K integers, ith integer, a[i] being the number of coins to be randomly chosen and reversed in the ith round.

Output:
The expected number of heads at the end of K rounds correct upto 6 decimal places.

Limits
1<=T<=200
1<=N<=10000
1<=K<=1000
1<=a[i]<=N

Sample Input
4
3
2
2 2
10
3
10 10 10
10
6
2 7 1 8 2 8
1000
10
916 153 357 729 183 848 61 672 295 936

Sample Output
1.666667
0.000000
4.792640
498.198077

Problem Setter: Dhruva Bhaswar


Languages: Brain,C,C++,Java,C#,JavaScript,Pascal,Perl,PHP,Python,Ruby,Text

Time Limit: 0.5 Second(s)
Score: 100 Point(s)
Input File Limit: 50000 Bytes

Submit

Login to post clarification.

No Clarifications.

Contest

Mode Judge

Passive

Online

Overall Rankings

RankNameScore
1xyz0
2Ams0
3TIP0
4team420
5xyzz0
6asdasdasd0
7abcd0
8khankhan0
9Gabriel0
10gigel0