MBEEWALK  Bee Walk
English  Vietnamese 
A bee larva living in a hexagonal cell of a large honey comb decides to creep for a walk. In each “step” the larva may move into any of the six adjacent cells and after n steps, it is to end up in its original cell. Your program has to compute, for a given n, the number of different such larva walks.
Input
The ﬁrst line contains an integer giving the number of test cases to follow. Each case consists of one line containing an integer n, where 1 ≤ n ≤ 14. SAMPLE INPUT 2 2 4
Output
For each test case, output one line containing the number of walks. Under the assumption 1 ≤ n ≤ 14, the answer will be less than 2^31. SAMPLE OUTPUT 6 90
hide comments
amulyagaur:
20180312 03:58:50
why #greedy?? 

learner4life:
20170909 03:22:43
Instead of using maps for negative coordinates, it is better to offset the origin by some amount. Then an array can be used. 

mahilewets:
20170831 09:05:27
Really


lord_poseidon:
20170723 20:16:27
Understand hexagonal coordinate system, game is over 

Nafis Islam:
20170608 03:17:19
simple dp :D 

ashishranjan28:
20161104 11:06:19
Last edit: 20170525 08:31:37 

xxbloodysantaxx:
20150711 15:28:21
I hard coded the value but I cannot understand how to memoize it ! When using Maps , the container is always empty initially ! Which is one of the values which leads to TLE as it was taking 2 seconds for n=14 !


Deepak Singh Tomar:
20150707 14:50:40
for those who are stuck at how to store intermediate results for ve coordinates... use map... :) 

AlphaDecay:
20150608 23:38:15
Awesome !! :D 

Dipankar Jana:
20150422 07:59:33
problem is not displaying. 
Added by:  ~!(*(@*!@^& 
Date:  20090224 
Time limit:  0.133s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  ADA95 ASM32 BASH BF C CSHARP CPP C99 CLPS LISP clisp LISP sbcl D FORTRAN HASK ICON ICK JAVA LUA NEM NICE OCAML PASGPC PASFPC PERL PHP PIKE PRLGswi PYTHON RUBY SCM guile SCM qobi ST WHITESPACE 