yaworsw/euler-manager

View on GitHub
data/problems/398.yml

Summary

Maintainability
Test Coverage
---
:id: 398
:name: Cutting rope
:url: https://projecteuler.net/problem=398
:content: |+
  Inside a rope of length <var>n</var>, <var>n</var>-1 points are placed with distance 1 from each other and from the endpoints. Among these points, we choose <var>m</var>-1 points at random and cut the rope at these points to create <var>m</var> segments.

  Let E(<var>n</var>, <var>m</var>) be the expected length of the second-shortest segment. For example, E(3, 2) = 2 and E(8, 3) = 16/7. Note that if multiple segments have the same shortest length the length of the second-shortest segment is defined as the same as the shortest length.

  Find E(10<sup>7</sup>, 100). Give your answer rounded to 5 decimal places behind the decimal point.