南邮 OJ 1498 Honeycomb Walk
Honeycomb Walk
时间限制(普通/Java) : 1000 MS/ 3000 MS 运行内存限制 : 65536 KByte总提交 : 34 测试通过 : 14
比赛描述
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.

输入
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.
输出
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.
样例输入
2
2
4
样例输出
6
90
题目来源
Nordic 2006
//dp[i][j][k] = 第 k 步走到(i,j)的走法
#include
#define N 15
int dp[N][N][N];
int dirX[6] = { 1, 0,-1,-1, 0, 1};
int dirY[6] = { 0, 1, 1, 0,-1,-1};int main(){int i,j,k,d,x,y;dp[7][7][0] = 1;for(k=1;k=0 && x=0 && y
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
