Statistics

Problem Statement for "TheBoredomDivOne"

Problem Statement

John and Brus are bored. They have n+m common friends. n of them are bored and m are not. Every hour John and Brus randomly choose two different friends A and B. If there are several possible pairs (A, B), each one has the same probability of being chosen. After that, John has a talk with friend A and Brus has a talk with friend B. For each of two chosen friends, if the friend is not bored, he becomes bored after the talk.

You have to find the expected time for all the friends to become bored.

Definition

Class:
TheBoredomDivOne
Method:
find
Parameters:
int, int
Returns:
double
Method signature:
double find(int n, int m)
(be sure your method is public)

Notes

  • The returned value must be accurate to within a relative or absolute value of 1E-9.

Constraints

  • n will be between 1 and 47, inclusive.
  • m will be between 1 and 47, inclusive.

Examples

  1. 1

    1

    Returns: 1.0

    There are two friends overall. Since John and Brus always choose different friends for a talk, both friends will be bored after one hour.

  2. 2

    1

    Returns: 1.5

    Here John and Brus can choose two friends that are already bored, so the expectation is more than 1 hour.

  3. 1

    2

    Returns: 2.0

  4. 4

    7

    Returns: 13.831068977298521

  5. 1

    3

    Returns: 3.4

  6. 5

    7

    Returns: 15.130274214949138

  7. 5

    7

    Returns: 15.130274214949138

  8. 25

    42

    Returns: 144.10605121277968

  9. 7

    19

    Returns: 45.46619363103156

  10. 40

    45

    Returns: 185.93004772631068

  11. 17

    32

    Returns: 98.65802187986704

  12. 43

    37

    Returns: 167.2564362404144

  13. 38

    13

    Returns: 80.5404811915203

  14. 23

    29

    Returns: 102.2529460584118

  15. 22

    35

    Returns: 117.38738121338442

  16. 18

    36

    Returns: 111.90968303530524

  17. 37

    35

    Returns: 148.49017388645055

  18. 18

    32

    Returns: 100.68748185421157

  19. 12

    22

    Returns: 62.05729455821641

  20. 37

    21

    Returns: 105.04611916550033

  21. 1

    42

    Returns: 92.18052432506396

  22. 1

    19

    Returns: 34.81755537072986

  23. 1

    45

    Returns: 100.22296540591749

  24. 1

    32

    Returns: 66.1848781573403

  25. 1

    37

    Returns: 79.01569196479905

  26. 1

    13

    Returns: 21.68611425271092

  27. 1

    29

    Returns: 58.66753502733225

  28. 1

    35

    Returns: 73.84071925118994

  29. 1

    36

    Returns: 76.42136199277984

  30. 1

    35

    Returns: 73.84071925118994

  31. 25

    1

    Returns: 13.0

  32. 7

    1

    Returns: 4.0

  33. 40

    1

    Returns: 20.5

  34. 17

    1

    Returns: 9.0

  35. 43

    1

    Returns: 22.0

  36. 38

    1

    Returns: 19.5

  37. 23

    1

    Returns: 12.0

  38. 22

    1

    Returns: 11.5

  39. 18

    1

    Returns: 9.5

  40. 37

    1

    Returns: 19.0

  41. 47

    47

    Returns: 207.71886934498465

  42. 1

    47

    Returns: 105.63993468806005

  43. 47

    1

    Returns: 24.0

  44. 25

    25

    Returns: 94.68530313377337

  45. 7

    7

    Returns: 17.727435221783047

  46. 40

    40

    Returns: 170.3153486399425

  47. 17

    17

    Returns: 57.849614911338

  48. 45

    47

    Returns: 203.28077550191213

  49. 37

    43

    Returns: 173.1555956596007

  50. 46

    46

    Returns: 202.30740031298058

  51. 45

    43

    Returns: 190.55621720432092

  52. 36

    18

    Returns: 93.73595311541357

  53. 46

    47

    Returns: 205.49982312701206

  54. 47

    46

    Returns: 204.515809325977


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: