#K5791. Minimum Bombs to Destroy a Circular Ring
Minimum Bombs to Destroy a Circular Ring
Minimum Bombs to Destroy a Circular Ring
You are given a circular ring divided into n cells. A bomb, when detonated, destroys up to 3 consecutive cells. Determine the minimum number of bombs needed to destroy all cells in the ring. Note that since the ring is circular, the arrangement is cyclic; however, it can be shown that the answer is the ceiling of \(\frac{n}{3}\).
Input: The first line contains a single integer T representing the number of test cases. Each of the following T lines contains an integer n (\(n \geq 3\)), indicating the number of cells in the corresponding circular ring.
Output: For each test case, output a single integer on a new line, indicating the minimum number of bombs required.
For example, when \(n = 4\), the answer is 2 bombs; when \(n = 7\), the answer is 3 bombs; and for \(n = 6\), the answer is 2 bombs.
inputFormat
The input is read from stdin and consists of:
- A line containing a single integer T, the number of test cases.
- T subsequent lines, each containing an integer n (\(n \geq 3\)), representing the number of cells in a circular ring.
outputFormat
For each test case, print the minimum number of bombs required (each on a new line) to destroy the circular ring.
The answer for each test case is \(\lceil \frac{n}{3} \rceil\).
## sample3
4
7
6
2
3
2
</p>