You are given ‘N’ coins, and an array ‘PROB’. These coins are “strange” because the probability of getting the head or tail is not ‘1/2’, the probability of getting a head face is denoted by the ‘PROB’ array. You are also given a positive integer ‘TARGET’, denoting the number of the coins facing heads you want if you toss every coin exactly once. Your task is to find out the “probability” of doing so.
Input Format :
The first line contains an integer ‘T’, which denotes the number of test cases to be run. Then, the T test cases follow.
The first line of each test case contains two positive integers, ‘N’, and ‘TARGET’, denoting the total number of coins and the number of coins facing heads respectively.
The second line of each test case contains ‘N’ space-separated real numbers, ‘PROB[i]’, representing the probability of the i-th coin of facing head when tossed.
Output Format :
For each test case, print the “probability” that the head-facing coins equal ‘TARGET’, as described in the problem statement.
Output for each test case will be printed in a separate line.
Note :
1. You do not need to print anything. It has already been taken care of. Just implement the given function.
2. Your answer will be accepted as correct if they are within 10^-6 of the correct answer.
Constraints :
1 <= ‘T’ <= 10
1 <= ‘N’ <= 1000
0 <= ‘TARGET’ <= N
0 <= ‘PROB[i]’ <= 1
PROB.length == ‘N’
Where ‘PROB[i]’ is the ith coin’s probability of facing the head when tossed.
Time Limit: 1sec