Delayed Work
InterviewTime limit1sMemory limit512 MB
Choose the integer number of painters that minimizes total cost X times painters plus K/P times P delay charge, then round to three decimals.
- Level
Medium5 of 10
- Topics
- Math, Brute force, Implementation, Binary search
- Solved
- No attempts yet
Problem
You run a company that paints houses. You can hire as many painters as you want, and each painter you hire costs dollars no matter how long that painter works. On top of that you pay a delay charge: if the job takes days, the charge is dollars. The charge does not depend on how many painters you hired, and does not have to be a whole number of days, so you pay only for the exact time taken.
All painters work at the same rate. One painter finishes a house in days, and they cooperate well enough that painters finish it in days.
Find the smallest total amount you have to pay for one house, counting both the painters and the delay charge. The number of painters you hire is an integer of at least 1.
Input
The first and only line contains three integers , , , separated by spaces. ()
Output
Print the minimum total cost on the first line, rounded to exactly three decimal places. Round a value that sits exactly halfway up. For example, prints as .