ACM: 简单 动态规划题 poj 3036
来源:互联网 发布:mac下面的图标怎么换掉 编辑:程序博客网 时间:2024/05/21 22:27
Description
A bee larva living in ahexagonal cell of a large honeycomb decides to creep for a walk. Ineach “step” the larva may move into any of the six adjacent cellsand after n steps, it is to end up in its originalcell.
Your program has to compute, for a given n, the number ofdifferent such larva walks.
Input
The first line contains aninteger giving the number of test cases to follow. Each caseconsists of one line containing an integer n, where 1 ≤n ≤ 14.
Output
For each test case, outputone line containing the number of walks. Under the assumption 1 ≤n ≤ 14, the answer will be less than231.
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()
{
//
}
- ACM: 简单动态规划题 poj 2955
- ACM: 简单 动态规划题 poj 3036
- ACM: 动态规划题 poj 2241
- ACM: 动态规划题 poj 1054
- ACM: 动态规划题 poj 2948
- ACM: 动态规划题 poj 1925
- ACM: 动态规划题 poj 3034
- ACM: 动态规划题 poj 2411
- ACM: 动态规划题 poj 1947
- ACM: 动态规划题 poj 2486
- ACM: 动态规划题 poj 3140
- ACM: 动态规划题 poj 3659
- ACM: 动态规划题 poj 2923
- ACM: dp动态规划题(难) poj 3267 …
- ACM: dp题(动态规划) poj 2151 (d…
- ACM: 树状DP 动态规划题 poj 1463 …
- ACM: 动态规划题 poj 2057 树状DP
- ACM: 简单 动态规划题 toj 1509 (…
- ACM: 动态规划题 poj 2241
- ACM: 动态规划题 toj1328
- ACM: 背包问题 动态规划题 toj 133…
- ACM: 动态规划体 toj 1408
- ACM: 训练题 动态规划题 (蛮有意思…
- ACM: 简单 动态规划题 poj 3036
- ACM: 动态规划题 toj 1508
- ACM: 简单 动态规划题 toj 1509 (…
- ACM: 图论题 poj 1135
- ACM: 图论题 poj 1161 (把图重建成…
- spark-graphx新的里程碑GraphDataFrames
- ACM: 闭包问题 图论题 (书上练习)
- ACM: 广搜 图论题 poj 1708
- ACM: 最近公共祖先问题 图论题