← All problemsSign in

Luffy and Island

Luffy needs to reach grandline ASAP. Lufi's ship is K kilometer far from grandline . But luffy consumes 1 unit of food for every kilometer the ship covers and luffy can never be hungry until he reaches grandline. There are N islands between ship's current position and grandline . ith Island is Di appart from grandline and has Ai amount of food. Luffy currently has F amount of food. You need to tel

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