All submissions for this problem are available.
In a gambling house, called Crazy Casino, there is a special slot machine before the exit. In this slot machine, there are SLOT many displays, each corresponds to one slot. In each slot, there are few coins with Happy mark and a single coin with Sad mark. On a hit, the machine independently chooses one element from each slot uniformly at random and displays them in the correponding screen. If the screen has all Sad marks, the player looses and he has to give up all his winnings. If all the marks are Happy, his earnings get doubled. Before playing this game the player is given iNEW many coins. Using each of these coins the player can increase the number of Happy marks in the slot of his choice. e.g. If the player puts three coins in slot 2, number of Happy marks in slot 2 gets increased by three. The player has to use all the iNEW coins before starting the game. Write a program to find out the minimum probability that a player looses against this machine.
You will be given an int SLOT representing total number of slots, an int iList with initial number of coins (INCLUDING the Sad mark) in each slot and an int iNEW, total number of additional coins available.
Your program should output p where 1/p is the minimum probability.
You can assume SLOT < 100, iNEW< 100, iList[i]<100 for all i.
The first input is the number of test cases (int)
For each of the test cases the input numbers are arranged as follows:
SLOT, iList, iNEW
Note that there is a comma (,) between SLOT and first element of iList. The elements of iList are separated by whitespace. Finally there is again a comma between the last element of iList and iNEW.
The datatype of output should be double.
Input: A sample input sequence may look like the following 2 3, 5 7 2, 2 4, 3 3 3 3, 1 Output: The corresponding output should be the following 140.00 108.00
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, GO, NODEJS, PYP3|
Fetching successful submissions
If you are still having problems, see a sample solution here.