FunctionRacerProblemsRace

Most Profit Plan

HardSciPyPython

A workshop makes several products. One unit of product j earns profit[j] and uses use[i][j] hours of machine i, and machine i has hours[i] hours. Any amounts can be made, fractions included, but not negative ones. Return the largest total profit. Answers within 0.001% are accepted.

Example 1

profit [3,5]
use [[1,0],[0,2],[3,2]]
hours [4,12,18]
returns 36.0

Make 2 of the first product and 6 of the second: 3 * 2 + 5 * 6 = 36, using every hour of the last two machines.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More SciPy problems