Cutting Rods
CodeChefOpen on judge ↗
Jimmy has a huge quantity of various steel rods of different lengths that he wants to sell. After a long search he was able to find a buyer. But the buyer has kept a condition that all the pieces of rods must be of same length. The buyer will pay as per the market price per unit length for the rods. Now, for making all rods of same length, Jimmy has to cut the rods which will incur him some cost.
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start