#Lutece0747. Birthday Party
Birthday Party
Migrated from Lutece 747 Birthday Party
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
persons have been invited to a somewhat special birthday party. Each person brings one present, but the recipent of each present is determined randomly. A person never receives his own present, but all other persons are equally likely recipients. What is the probability that one can find persons at the party such that person gives his present to person , person gives his present to person and so on to person which gives his present to person ?
Input
The first line of the input consists of a single integer , the number of test cases. Each test case consists of two integers and .
Output
For each test case, output the probability with an accuracy of at least
Samples
4
2 2
3 2
3 3
10 3
1.000000000
0.750000000
0.250000000
0.313469843
Note
Resources
IDI Open Programming Contest April 21st, 2012 - NTNU