Ice cream problem

Question

Hints

Answer