values and wants to cut it into runs of consecutive days, at most parts of them. Every day must belong to exactly one run, runs are non-empty and keep the original order.
The score of a split is the sum of the averages of its runs. Return the highest score you can get.
The answer is a real number; anything within 10⁻⁶ of it is accepted.values=[6, 2, 4, 10], parts=2 → 14.0
The best cut takes off the last element: [6, 2, 4] and [10]. The averages are 4 and 10, total 14.
values=[3, 7, 5], parts=3 → 15.0
Every element is its own piece: 3 + 7 + 5 = 15.
values=[1, 2, 6], parts=1 → 3.0
No cuts allowed, so there is one piece with average (1 + 2 + 6) / 3 = 3.
values=[6, 2, 4, 10], parts=2
14.0
Run checks the first 3 tests in your browser. Submit checks all 103 tests on the server, hidden ones included.