KMOVES - Knight Moves

no tags 

A knight is located at the (black) origin of an infinite chessboard. Let f(n) define the number of black squares the knight can reach after making exactly n moves. Given n (0 <= n <= 108), output f(n).

Input

The first line of the input contains a single integer T, the number of test cases (1 <= T <= 106). Each test case consists of a single positive integer n.

Output

For each value of n in the input, print a single line containing.

Example

Input:
2
0
1

Output:
1
0

hide comments
liziheng: 2022-08-17 14:52:15

When n is 2, the answer is 33.

chenye3: 2022-08-17 13:13:42

Is the answer is 32 when n is 2?

jmr99: 2018-10-12 09:00:05

not easy but did it. ^ __ ^

amit_gh: 2017-05-13 12:44:01

For some reason my Java solution was giving wrong answer. Same algorithm got accepted in python. Got 3 WAs due to that.

darryl: 2017-02-22 07:19:41

cool

anurag garg: 2014-02-17 06:05:49

easy

Last edit: 2014-02-17 06:06:24
Amlesh Jayakumar: 2013-11-21 06:40:41

Explanation of sample output:
In 0 moves, the knight can reach 1 black square (namely the square it starts on). In 1 move it can't reach any black squares, since any knight move from a black square leads to a white square, hence the output 0.

Goldie: 2012-12-25 16:36:29

Please can someone explain the output.
Not getting clear picture what is required be done here.

(Tjandra Satria Gunawan)(曾毅昆): 2012-07-13 20:28:21

This is Fun :)

Mostafa 36a2: 2012-07-13 16:58:21

I See ... I See -_-


Added by:Amlesh Jayakumar
Date:2009-12-16
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 PERL6
Resource:Own