动态规划
动态规划算法,俗称dp
狗熊狗弟
星空很远,向前却不难
展开
-
Hdu2084
数塔Problem Description在讲述DP算法的时候,一个经典的例子就是数塔问题,它是这样描述的:有如下所示的数塔,要求从顶层走到底层,若每一步只能走到相邻的结点,则经过的结点的数字之和最大是多少?#include <iostream>#include<map>#include<stdio.h>#include<algorithm...原创 2019-04-03 20:42:35 · 202 阅读 · 0 评论 -
最大子串和(简单动态规划)
1007 Maximum Subsequence Sum (25 分)题目链接 也是突然明白最大子串的首位置必然在子串和为负数的后一位,或者是在全子串均为非负数时,首位置就是第一位。首位置也不能时时刷新,只有最大值发生改变,首位置变化才有意义,所以需要变量tmp时时记录#include<iostream>#include<stdio.h>#include<...原创 2019-03-26 22:06:20 · 1139 阅读 · 0 评论 -
Hdu1069 Monkey and Banana(背包问题?)
Monkey and BananaProblem DescriptionA group of researchers are designing an experiment to test the IQ of a monkey. They will hang a banana at the roof of a building, and at the mean time, provide th...原创 2019-04-04 22:14:12 · 104 阅读 · 0 评论 -
Hdu 2602(动态规划入门)
Bone Collector最近开始整理动态规划,希望对自己有所帮助。01背包模板题Problem descriptionMany years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect varies of bones , such a...原创 2019-04-01 21:46:36 · 353 阅读 · 0 评论 -
Hdu1159 Common Subsequence(简单递归)
Hdu1159Common SubsequenceProblem DescriptionA subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = <x1, x2, ..., xm> anoth...原创 2019-04-07 17:59:23 · 136 阅读 · 0 评论 -
Hdu1203(01背包)
I NEED A OFFER!Problem DescriptionSpeakless很早就想出国,现在他已经考完了所有需要的考试,准备了所有要准备的材料,于是,便需要去申请学校了。要申请国外的任何大学,你都要交纳一定的申请费用,这可是很惊人的。Speakless没有多少钱,总共只攒了n万美元。他将在m个学校中选择若干的(当然要在他的经济承受范围内)。每个学校都有不同的申请费用a(万美元),并...原创 2019-04-02 09:49:32 · 105 阅读 · 0 评论 -
Consecutive Subquence
You are given an integer array of lengthnn.You have to choose some subsequence of this array of maximum length such that this subsequence forms a increasing sequence of consecutive integers. In oth...原创 2019-04-12 08:27:17 · 181 阅读 · 0 评论 -
How do you add it?
Larry is very bad at math — he usually uses a calculator, which worked well throughout college. Unfortunately, he is now struck in a deserted island with his good buddy Ryan after a snowboarding accid...原创 2019-04-12 08:38:42 · 162 阅读 · 0 评论