hdu 2323 Honeycomb Walk
来源:互联网 发布:卫生间js防水技术交底 编辑:程序博客网 时间:2024/06/06 03:34
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.
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
224
Sample Output
690带点搜索意味的dp#include<iostream>#include<cstring>using namespace std;int dp[17][30][30],p=15,q=15;int to[6][2]={1,0,-1,0,1,1,0,1,-1,-1,0,-1};int main(){ int i,j,k,l,t,n; memset(dp,0,sizeof dp); dp[0][p][q]=1; for(i=1;i<15;i++) { for(j=0;j<30;j++) { for(k=0;k<30;k++) { for(l=0;l<6;l++) { int r=j+to[l][0]; int c=k+to[l][1]; dp[i][j][k]+=dp[i-1][r][c]; } } } } cin>>t; while(t--) { cin>>n; cout<<dp[n][p][q]<<endl;; } return 0;}
0 0
- hdu 2323 Honeycomb Walk
- HDU--杭电--2323--Honeycomb Walk--DP
- 2489. Honeycomb Walk
- Sicily 1415. Honeycomb Walk
- POJ 3036 Honeycomb Walk(DP)
- 南邮 OJ 1498 Honeycomb Walk
- POJ-3036 Honeycomb Walk 简单DP
- poj 3036 Honeycomb Walk 暴力枚举 dp
- HDU Walk
- hdu 4444 Walk
- hdu 4444 Walk
- HDU 4444 - Walk
- hdu 5001 Walk(概率)
- HDU 5001 Walk (暴力)
- HDU - 5001 Walk
- HDU P5001 Walk
- hdu 5001 walk
- HDU 5001 Walk
- ODR规则
- java rsa加密解密
- 结构体
- 【UVA】624-CD(动态规划01背包问题)
- 安卓四大核心组件之Activity
- hdu 2323 Honeycomb Walk
- 判断view是否可见
- c++中类型的转化
- Comparator接口的使用方法
- hdu 1075 What Are You Talking About 字典树
- <!DOCTYPE> 标签
- 空心三角形 hdoj 2091
- poj2955 Brackets
- eclipse导入项目中文乱码