Road trip
CodeChefOpen on judge ↗
Phileas Fogg and Passepartout are now going on a road trip in their brand new car. They start at location A0 and need to go to AN. Their car has a capacity to hold only C units of fuel and can travel unit distance on unit amount of fuel. They start by filling some amount of fuel from the filling station at A0. On the way, there are several filling stations A1, A2,... AN-1. The cost of fuel is not
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