The Children and Candies
CodeChefOpen on judge ↗
There are n children with indices $1$ to $n$. The $i$th child has a bag which can hold $Ai$ candies. We have m packets of candies . The $ith$ packet contains $Bi$ candies. Now for each packet we start distributing candies to the children starting from index 1. When the $i$th child bag gets fully filled we continue distributing candies to the $( i+1)$ th child until all the candies from the choose
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