Woburn Challenge 2016-17 Round 1 - Senior Division
You and your friends have had enough of this Halloween nonsense. You nabbed your fair share of candy in the past, sure, but you wouldn't be caught dead parading around in a costume now that you're in high school. That doesn't mean this dumb excuse for a holiday has to go to waste, though… No way. It's time to have some real fun.
There are nice-looking houses on your street, but they won't be looking nice for long. Having borrowed your family car for the night, you'll be taking a joy ride down the street with your friends and some bathroom supplies in tow. Your plan is to take passes along the street, and on each pass, you'll choose a random pair of distinct houses (chosen uniformly at random from all possible pairs) to be your targets. Then, those two houses will each receive a little punishment… Bam! Toilet paper to the face!
Once you've TP-ed a house in this fashion, it will be thoroughly covered in the stuff. It may get chosen as a target again on future passes, but applying toilet paper multiple times will have no additional effect on it.
This is sure to be a sweet night, but now you're wondering just how much carnage you and your friends will inflict on your lame neighbourhood. What's the expected number of different houses which will have been TP-ed at least once by the end of Halloween?
In test cases worth of the points, and .
In test cases worth another of the points, and .
In test cases worth another of the points, and .
Input Specification
The first and only line of input consists of two space-separated integers and .
Output Specification
Output one line consisting of a single real number - the expected number of houses which will be covered in toilet paper after all passes, with at most absolute or relative error.
Sample Input
3 2
Sample Output
2.666667
Sample Explanation
There are possible pairs of distinct houses - , , and . Therefore, there are equally-likely pairs of houses which will be TP-ed on the two passes. of these result in only distinct houses being covered in toilet paper (for example, being targeted on both passes). The other of them result in all houses being covered. Therefore, the expected number of houses which will be covered in toilet paper is .
Comments