시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
0.5 초 | 512 MB | 64 | 22 | 19 | 32.203% |
Today is the birthday of Farmer Eric’s cow, Emily. Since Emily didn’t manage to get a present last year, Eric wants to give her a square with delicious grass.
Farmer Eric’s farm has a broad field with $n^2$ pillars arranged in $n$ rows and $n$ columns. (The distance between the nearest pillars is $1 \, \mathrm{m}$.)
He started to plan for Emily's birthday present to make Emily happy. In a couple of minutes, he figured out that the square should satisfy the following conditions:
For convenience, you can ignore the height and the thickness of the pillars.
Farmer Eric was thinking about the number of possible birthday presents for Emily but just gave up counting(probably because there was work left to do). Can you count it instead?
The first line contains the number $T$ — the number of test cases.
The single line of each test case contains two integers $n$ and $a$.
For each test case, print the number of possible birthday presents for Emily. If there aren't any, print 0
.
3 2 1 2 2 3 3
1 0 1
In the third test case, the only possible birthday present is below. (The orange square represents Emily’s present.)