All submissions for this problem are available.
Alice's school is planning to take some students from her class on a field trip. Alice is really excited about it. There are a total of S students in her class. But due to budget constraints, the school is planning to take only N students for the trip. These students will be picked randomly. And each student has equal chance of being picked.
Alice's friend circle has M students including her. Though she is excited about the field trip, she will enjoy it only if there are atleast K of her friends with her on the trip. She is wondering what are the chances of that happening. She needs your help. Tell her the probability that she will enjoy given that she goes on the trip.
First line of input contains a single integer T, the number of test cases.
Each test starts with a single line having 4 space separated integers, S, N, M and K.
For each test case, output a line containing the required probability. The answer will be accepted if the relative error is not more than 10-6.
1 ≤ T ≤ 100 1 ≤ S ≤ 1000 1 ≤ N ≤ S 1 ≤ M ≤ S 0 ≤ K < M
3 10 10 5 3 10 4 6 4 3 2 2 1
1.000000 0.000000 0.500000
Every student will be taken to the trip. So all her 4 friends will accompany her to the trip no matter what.
Alice wants 4 out of her 5 friends to come along with her which isn't possible because the school is willing to pick only 4 students for the trip.
|Tags||may13, probability, simple, simple-math, vamsi_kavala|
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions