Description
![ACM: <wbr>简单 <wbr>动态规划题 <wbr>poj <wbr>3036 ACM: <wbr>简单 <wbr>动态规划题 <wbr>poj <wbr>3036](https://i-blog.csdnimg.cn/blog_migrate/a4c26d1e5885305701be709a3d33442f.gif)
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.
Sample Input
2
2
4
Sample Output
6
90
题意: 蜜蜂可以在当前区域走向相邻的6个区域, 问你蜜蜂走n步可以回到原来的区域有多少种走法.
解题思路:
代码:
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
#define MAX 17
int dir[6][2] = {{1,0}, {-1,0}, {0,1}, {0,-1}, {1,-1}, {-1,1}};
int n;
int dp[MAX][MAX][MAX];
void DP()
{
}
int main()
{
//
}