| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 7 | 5 | 5 | 71.429% |
Count the number of distinct squares you can draw using only integer co-ordinates for its 4 corners with the following restrictions.
Two squares are distinct if and only if at least one of its corners is different.
Note that the edges can go through the central forbidden square. The only condition is that the corners itself should not lie in the central forbidden square.
The above figure shows the case n = 2 and k = 1. In the figure the central 2 x 2 square is forbidden and the forbidden lattice points are marked with red. When drawing a square you cannot use these points (marked red) for any of the corners. You are allowed to use only the points marked with black. So the only allowed square you can draw is the 4 x 4 square. Hence the answer for this case is 1.
The first line contains one integer t, the number of testcases. (1 ≤ t ≤ 50)
This will be followed by t test cases. Each case is specified in a separate line containing two space separated integers n and k.
For each testcase print the number of distinct squares you can draw under the given constraints.
2 2 1 3 1
1 30