#C6469. Minimum Operations Reducer

    ID: 50232 Type: Default 1000ms 256MiB

Minimum Operations Reducer

Minimum Operations Reducer

Given an integer n, you need to reduce it to zero using the minimum number of operations. In each operation, you can subtract either 1, 2, or 5 from n. The goal is to determine the minimum number of operations required to reduce n to zero.

Example: For n = 11, one optimal sequence of operations is: 11 - 5 = 6, 6 - 5 = 1, and 1 - 1 = 0. Therefore, the minimum number of operations is 3.

The subtraction options are conceptually similar to the coin change problem with coin denominations \(\{1, 2, 5\}\).

inputFormat

The input is read from stdin and is structured as follows:

  • The first line contains a single integer T, representing the number of test cases.
  • Each of the following T lines contains a single integer n, the number to reduce to zero.

outputFormat

For each test case, output the minimum number of operations required to reduce n to zero. Each result should be printed on a separate line to stdout.

## sample
3
11
5
9
3

1 3

</p>