Game of Pooks CodeChef Solution | CodeChef Problem Solution 2022
We have found a new chess character — pook. It has the qualities of both a rook and a pawn. Specifically, treating the chessboard to be an grid where denotes the intersection of the -th row and the -th column, a pook placed at square threatens the following squares:
- for every
- for every
- , if and
- , if and
Find the maximum number of pooks that can be placed on an empty chessboard such that none of them threaten each other.
Input Format
- The first line of input will contain a single integer , denoting the number of test cases. Then the test cases follow.
- Each test case consists of a single line of input, containing a single integer .
Output Format
For each test case, output in a single line the maximum number of pooks that can be placed on the chessboard such that they don't threaten each other.
Constraints
Sample Input 1
3
1
2
3
Sample Output 1
1
1
2
Explanation
Test case : There is a single square, so we have a single pook.
Test case : We can only place one pook. No matter where the first is placed, placing a second will lead to one of the two being threatened.
Test case : Placing pooks on a grid is easy — for example, place one at and another at . It can be shown that placing three is not possible.
Join Now for Solution:-
No comments:
Post a Comment