Coin order problem

Question

Hints

Answer