Let there be a chessboard of size , and only one bishop in a cell . How many cells can the bishop can attack in one move? You can assume that one possible move is staying in the current position.
In the first line of input, there will be a number () denoting the number of test cases.
On the next lines, there will be four integers , , , as described above. Here () is the number of columns and () is the number of rows. The bishop is at column (), row ().
For each test case print a single line with the number of cells the bishop can attack with one move.
2 8 6 2 4 8 6 1 1
The image above is a visualization of the first case.
Login to submit
The bishop can go to 4 directions (diagonally). The number of cells in the upper-left direction (the...