shunfurh
编程介的小学生
2019-02-11 10:47

算法图论,六边形的移动步骤问题,采用C语言进行回答的方式

  • Golang
  • r语言
  • erlang

Problem Description
A bee larva living in a hexagonal cell of a large honeycomb 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 first 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.

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 231 - 1.

Sample Input
2
2
4

Sample Output
6
90

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

0条回答