Ishan and Coins

0

0 votes
Medium
Problem

Ankur likes Antique items and has collected N coins that he bought from Kerala. He is so much obsessed with the picture on heads side of the coins , so all N coins on the table have heads up.

Ishan, however has an evil plan. He first randomly chooses ARR[0] coins and reverses them, then randomly choose ARR[1] coins and reverses them.....and finally randomly choose ARR[K-1] coins and reverses them.

Calculate and return the expected number of heads Ankur is left with after these operations.

CONSTRAINTS:
1 ≤ N103
1 ≤ K ≤ 50.
Each element in a will be between 1 and N, inclusive.

INPUT:
Two integers N and K. In the next line there are K integers.

OUPUT:
A double value denoting expected no. of coins Ankur is left with. You must print the answer upto 6 decimal places.
E.g. If your answer is 1.666666666667 then you must print 1.666667 .
See the sample test case for more details.

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?