← All problemsSign in

Mileage matters

CodeChefRating 831Open on judge ↗

Chef wants to rent a car to travel to his restaurant which is $N$ kilometers away. He can either rent a petrol car or a diesel car. One litre of petrol costs $X$ rupees and one litre of diesel costs $Y$ rupees. Chef can travel $A$ kilometers with one litre of petrol and $B$ kilometers with one litre of diesel. Chef can buy petrol and diesel in any amount, not necessarily integer. For example, if

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start