← All problemsSign in

Buckets Full of Candies

CodeChefRating 1583Open on judge ↗

Today is your birthday. You have decided to give away candies to your friends. You have $N$ friends and $M$ candies. Suppose the $1^{st}$ friend has $L$ buckets, $2^{nd}$ has $L+1$ buckets, $3^{rd}$ has $L+2$ buckets, and so on — in general, the $i^{th}$ friend has $L + i - 1$ buckets. You start distributing candies from the $N^{th}$ friend and go towards the $1^{st}$ friend. For each friend

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