fb pixel

Paying in a shop

When doing groceries, you really like when you pay with as few coins as possible. You have several 50s, some 20s, some 10s, 5s, and also 1s.
Given your whole purchase total t, how many coins do you need to pay for the groceries (It’s guaranteed that you have enough money for that)?
Input
Output
51
2
111
4
 
To check your solution you need to sign in
Sign in to continue