#C4464. Minimum Coins Problem

    ID: 48005 Type: Default 1000ms 256MiB

Minimum Coins Problem

Minimum Coins Problem

You are given an integer n which represents an amount in cents. Your task is to determine the minimum number of coins required to make up that amount using only the following coin denominations:

  • Dime: 10 cents
  • Nickel: 5 cents
  • Penny: 1 cent

You should use the greedy approach, which works correctly for these canonical coin denominations. In mathematical terms, if n is the amount, then the total number of coins used is given by:

\[ \mathrm{coins}(n) = \left\lfloor \frac{n}{10} \right\rfloor + \left\lfloor \frac{n - 10 \left\lfloor \frac{n}{10} \right\rfloor}{5} \right\rfloor + \left(n - 10 \left\lfloor \frac{n}{10} \right\rfloor - 5 \left\lfloor \frac{n - 10 \left\lfloor \frac{n}{10} \right\rfloor}{5} \right\rfloor\right) \]

Implement a program to solve this problem.

inputFormat

The input is given in stdin and consists of a single line containing an integer n (0 ≤ n ≤ 106), which represents the amount in cents.

outputFormat

Output the minimum number of coins required to make the given amount. The output should be printed to stdout as a single integer.

## sample
28
6