Fair Division#506

Fair Division (Editorial)

Author, developer, author of the solution: Andriy Stolitniy

Each girl must end up with the same number of apples. Let this number be . Then

3x = a + b + c
x = \dfrac{a + b + c}{3}.

Then, if a girl has more than apples, she must give away the excess. The answer to the problem will be

\max(0, a - x),\quad \max(0, b - x),\quad \max(0, c - x).