Time Limit: 2 Seconds
Memory Limit: 65536 KB
Balls of N different colors are put inside a box. There are Mi balls of color i.
What is the possibility of taking K balls out of the box and exactly Pj of them
are of color j for each j = 1, 2, ..., N.
Input contains several cases, each of which occupies 3 lines. The first line
contains two non-negative integers N and K. The next line has N positive integers
M1, M2, .... Mn, followed by a line with N non-negative integers P1, P2, .... Pn.
It is guaranteed that K = P1 + P2 + ... + Pn. You may also assume that the total
number of balls in any of the cases does not exceed 50.
Subsequent test cases are separated with a single blank line.
The input is terminated with two -1's. This case is not to be processed.
One number on a single line for each case - the possibility.
Round to 5 digits after the decimal point.
2 2 2
1 1 1
Author: PAN, Minghao
Source: Zhejiang University Local Contest 2004