Problem 4
CodeChefOpen on judge ↗
Yash is going for a tour lasting N days. He takes packages of chapati for food. Each package has K chapatis. On the ith day, he eats Ai pieces of chapati. Unfortunately, Yash, as we know, is very lazy, always forgets to close the package of chapatis, so each day the last piece of chapati becomes exposed to mold (a fungus), and is no longer suitable for eating and is thrown away. Suppose if K = 4
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