← All problemsSign in

Divide into 3

CodeChefRating 350Open on judge ↗

You have $N$ toffees and $3$ friends. You will divide the toffees among your friends (You are too generous to take one yourself). You want to make sure that your division is fair. Hence, you want to minimize the *imbalance* of your division. Here, the imbalance is defined as $(\text{mx} - \text{mn})$, where $\text{mx}$ is the maximum toffees any friend received, and $\text{mn}$ is the minimum t

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