← All problemsSign in

Chef loves Charity

Chef loves helping the poor and is very sad seeing the difference between rich and poor rising day by day in Chefland. One day he decides to steal exactly $1$ rupee coin every day from the richest person and give it to the poorest person. Chef has only $K$ days left. If any day all people in Chefland have the same amount of money he will not take or give any amount of coins. Find the difference

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