Problem H
The Sock Pile

This problem is based on an (almost) true story. A child, who shall remain nameless, has a large pile of clean socks. This pile contains $m$ pairs of socks with pictures and patterns and $n$ pure white socks. Each pair of socks consists of two identical socks and every pair is unique — no two pairs look the same. All pure white socks are identical. Each day, the child randomly selects two socks from the pile, puts them on, and heads for school.

But today is a picture day and the child needs to wear two identical socks. So the child randomly selects two socks and if both socks are identical, the child puts them on and heads out the door. If the two socks are not identical, the child throws the socks into the laundry basket (they are now dirty — don’t ask why) and continues the same process of randomly selecting two socks from the pile of remaining clean socks. As this process continues, the parents are starting to get worried: Will this child ever make it to school today? Please help them to compute the probability that the child will not find a pair of identical socks using this process.


The input consists of a single line containing two numbers: $m$, the number of pairs of patterned socks, and $n$, the number of white socks. You may assume that each number is non-negative and that $m \leq 500$ and $n \leq 200$.


The output consists of a single line. The line contains the probability that the child will not succeed in randomly selecting a pair of identical socks. Output within a relative tolerance of $1\times 10^{-6}$ will be accepted.

Sample Input 1 Sample Output 1
2 3

Please log in to submit a solution to this problem

Log in