经典 dp
胆识与智慧
在探索中成长
展开
-
POJ 1159 Palindrome 最大公共子序列+滚动数组
题目描述:A palindrome is a symmetrical string, that is, a string read identically from left to right as well as from right to left. You are to write a program which, given a string, determines the m原创 2018-01-31 11:08:43 · 176 阅读 · 0 评论 -
Hdu 2084 数塔 简单
Hdu 2084题目描述:在讲述DP算法的时候,一个经典的例子就是数塔问题,它是这样描述的: 有如下所示的数塔,要求从顶层走到底层,若每一步只能走到相邻的结点,则经过的结点的数字之和最大是多少? 已经告诉你了,这是个DP的题目,你能AC吗?Input输入数据首先包括一个整数C,表示测试实例的个数,每个测试实例的第一行是一个整数N(1 Output原创 2018-01-31 20:32:23 · 220 阅读 · 0 评论 -
Hdu 2577 How To Type 分类 dp
题目描述:Pirates have finished developing the typing software. He called Cathy to test his typing software. She is good at thinking. After testing for several days, she finds that if she types a str原创 2018-01-31 23:57:35 · 192 阅读 · 0 评论 -
牛客网 D-YB要打炉石 最大上升子序列
链接:https://www.nowcoder.com/acm/contest/74/D来源:牛客网时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536K64bit IO Format: %lld题目描述Wozuinb非常喜欢打炉石传说,但是菜的不行,所以他决定打竞技场来练练手。系统按顺序给出n张卡牌,每张原创 2018-01-31 13:12:27 · 320 阅读 · 0 评论 -
牛客网 G-送分了 QAQ 数位 dp入门
时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536K64bit IO Format: %lld题目描述链接:https://www.nowcoder.com/acm/contest/74/G来源:牛客网杭州人称傻乎乎的人为62,而嘟嘟家这里没有这样的习俗。相比62,他那里的人更加讨厌数字38,当然啦,还有4这原创 2018-02-01 16:45:07 · 318 阅读 · 0 评论 -
牛客网 B-TaoTao要吃鸡 01背包
链接:https://www.nowcoder.com/acm/contest/74/B来源:牛客网时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536K64bit IO Format: %lld题目描述Taotao的电脑带不动绝地求生,所以taotao只能去玩pc版的荒野行动了,和绝地求生一样,游戏人物本身原创 2018-02-01 21:55:18 · 348 阅读 · 0 评论 -
字符串编辑距离 经典 dp
可以参考这个博客:点击打开链接比较两个字符串相似度,可以通过最长公共子串,或者最长公共子序列,还有就是编辑距离。两个字符串通过插入,删除或者修改,来达到一致,编辑距离越短,可知相似度越高。#include using namespace std ;#define Min( a , b , c ) ( a < b ? ( a < c ? a : c ) : ( b < c ? b : c原创 2018-02-04 23:39:46 · 519 阅读 · 0 评论 -
Hdu 1159 最大公共子序列
题目略,求两个字符串的最大上升子序列长度。当前状态只和前一个状态有关,经典 dp +滚动 , 可以不用记录路径#include #include #include using namespace std ;int dp[2][5005] ; char s1[5005] , s2[5005] ; int main(){ int i = 1 , j = 1 , n ,原创 2018-02-01 00:16:42 · 319 阅读 · 0 评论 -
生物信息学习笔记 (3) 找零钱
经典问题,给定一些面额的纸币,和要找回金币的总额,找出使得纸币数量最少的方案今天第一次写 Java, 开始 Java 学习之旅吧 public class Make_Change { public static void main ( String[] args ) { final int [] Value = new int[] { 1 , 2 , 5 , 10 , 20 ...原创 2018-08-01 17:38:32 · 186 阅读 · 0 评论