Ball Distribution
CodeChefOpen on judge ↗
There are B balls, numbered 1 to B. The Chef is distributing all B balls among B children, giving one ball to every child. He does that iteratively. In the first pass, starting from the first ball he gives out every alternate ball, in the second pass, he gives out every third ball starting from the first remaining ball, in the kth pass, he gives out every (k+1)th ball. He does this until all the b
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