#C3237. Minimum Boxes to Pack Widgets
Minimum Boxes to Pack Widgets
Minimum Boxes to Pack Widgets
Your task is to calculate the minimum number of boxes required to pack a given number of widgets. There are three types of boxes available:
- Large box: can hold up to 5 widgets.
- Medium box: can hold up to 3 widgets.
- Small box: can hold 1 widget.
You must pack the widgets using the largest boxes possible first. In other words, first use as many large boxes as you can, then use medium boxes for the remainder, and finally use small boxes for any widgets that are still left. This strategy minimizes the total number of boxes used.
The mathematical formulation is as follows: \[ \text{large} = \left\lfloor \frac{n}{5} \right\rfloor,\quad \text{medium} = \left\lfloor \frac{n \bmod 5}{3} \right\rfloor,\quad \text{small} = n \bmod 3 \text{ (after using large and medium boxes)} \]
The final answer is:
\[ \text{boxes} = \text{large} + \text{medium} + \text{small} \]inputFormat
The input begins with an integer \(T\) representing the number of test cases. Each of the following \(T\) lines contains a single integer \(n\), the number of widgets to be packed.
outputFormat
For each test case, output a single integer representing the minimum number of boxes required to pack all \(n\) widgets. Each answer should be printed on a new line.
## sample1
1
1