汉诺塔
汉诺塔II hdu1207:
先说汉若塔I(经典汉若塔问题),有三塔,A塔从小到大从上至下放有N个盘子,现在要搬到目标C上,
规则小的必需放在大的上面,每次搬一个,求最小步数。这个问题简单,DP:a[n]=a[n-1]+1+a[n-1],先把
上面的n-1个放在B上,把最大的放在目标C上,再把N-1个放回到C上即可。
网上的一种最优解法如下:(1)将x(1
#inc...
分类:
其他好文 时间:
2014-07-20 23:18:31
阅读次数:
272
/*
C - 简单dp 例题
Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64u
Submit
Status
Description
A subsequence of a given sequence is the given sequence with some elements (poss...
分类:
其他好文 时间:
2014-07-18 22:28:24
阅读次数:
206
/*
B - 简单dp 例题
Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64u
Submit
Status
Description
7
3 8
8 1 0
2 7 4 4
4 5 2 6 5
(Figure 1)
Figure 1 shows a nu...
分类:
其他好文 时间:
2014-07-18 22:23:40
阅读次数:
226
/*
D - 简单dp 例题
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u
Submit
Status
Description
Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum ...
分类:
其他好文 时间:
2014-07-18 22:23:25
阅读次数:
231
/*
H - 简单dp 例题扩展
Time Limit:3000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u
Submit
Status
Description
A palindrome is a symmetrical string, that is, a string read identically from ...
分类:
其他好文 时间:
2014-07-18 22:23:07
阅读次数:
235
/*
F - 简单dp
Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64u
Submit
Status
Description
You want to arrange the window of your flower shop in a most pleasant way. You have...
分类:
其他好文 时间:
2014-07-18 21:31:53
阅读次数:
277
题目链接:点击打开链接
给定n*m 的矩阵 常数k
下面一个n*m的矩阵,每个位置由 0-9的一个整数表示
问:
从最后一行开始向上走到第一行使得路径上的和 % (k+1) == 0
每个格子只能向↖或↗走一步
求:最大的路径和
最后一行的哪个位置作为起点
从下到上的路径
思路:
简单dp
#include
#include
#include
#include
#...
分类:
其他好文 时间:
2014-07-17 20:15:08
阅读次数:
283
/*
A - 简单dp 例题
Time Limit:1000MS Memory Limit:30000KB 64bit IO Format:%I64d & %I64u
Submit
Status
Description
A military contractor for the Department of Defense has just completed a series o...
分类:
其他好文 时间:
2014-07-16 16:15:03
阅读次数:
278
HDU--2084数塔题意:自上而下,选择一条累计和最大的路径分析:顶点只与左右两个子节点相关,且子节点路径的选择与顶点无关(无后效性)状态dp[i][j]:表示(i,j)点向下得到的最大累计和转移方程:dp[i][j]=max(dp[i+1][j],dp[i+1][j+1])+v[i][j];核心:for(i=n;i>=1;i--)..
分类:
其他好文 时间:
2014-07-13 14:36:57
阅读次数:
180
poj1163The Triangle(简单DP)...
分类:
其他好文 时间:
2014-07-12 19:45:10
阅读次数:
168