
动态规划
RPG_Zero
春日雨,夏蝉鸣,明天是个好天气。
秋风起,雪花轻,海底看不见四季。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
POJ 2385 Apple Catching 简单DP
DescriptionIt is a little known fact that cows love apples. Farmer John has two apple trees (which are conveniently numbered 1 and 2) in his field, each full of apples. Bessie cannot reach the apple...原创 2019-08-13 14:40:15 · 227 阅读 · 0 评论 -
POJ 1065 Wooden Sticks 贪心+动态规划之单调递增子序列
DescriptionThere is a pile of n wooden sticks. The length and weight of each stick are known in advance. The sticks are to be processed by a woodworking machine in one by one fashion. It needs some ...原创 2019-08-17 22:30:30 · 209 阅读 · 0 评论 -
动态规划 背包问题小结 0-1背包(采药 九度第101题) 完全背包(Piggy-Bank POJ 1384) 多重背包(珍惜现在,感恩生活 九度第103题)
本小结介绍0-1背包、完全背包以及多重背包问题记忆要点:0-1背包:二维数组情况下,顺序遍历体积或者倒序均可以 降维情况下需倒序遍历体积完全背包:数组降维+顺序遍历多重背包:进行类似于二进制分解的操作,然后转化为...原创 2019-08-16 21:25:56 · 407 阅读 · 2 评论 -
合唱队形 动态规划 最长递增子序列
1.题目描述N位同学站成一排,音乐老师要请其中的(N-K)位同学出列,使得剩下的K位同学不交换位置就能排成合唱队形。 合唱队形是指这样的一种队形:设K位同学从左到右依次编号为1, 2, …, K,他们的身高分别为T1, T2, …, TK, 则他们的身高满足T1 < T2 < … < Ti , Ti > Ti+1 > … > TK (1 <= i &l...原创 2019-07-04 20:55:30 · 652 阅读 · 0 评论 -
POJ 2229 Sumsets 解题报告 动态规划
DescriptionFarmer John commanded his cows to search for different sets of numbers that sum to a given number. The cows use only numbers that are an integer power of 2. Here are the possible sets of ...原创 2019-08-12 20:02:40 · 322 阅读 · 0 评论 -
POJ 3181 Dollar Dayz 完全背包 高精度dp 大数
DescriptionFarmer John goes to Dollar Days at The Cow Store and discovers an unlimited number of tools on sale. During his first visit, the tools are selling variously for $1, $2, and $3. Farmer Joh...原创 2019-08-16 15:21:56 · 204 阅读 · 0 评论 -
POJ 3176 Cow Bowling 入门级动态规划
DescriptionThe cows don’t use actual bowling balls when they go bowling. They each take a number (in the range 0…99), though, and line up in a standard bowling-pin-like triangle like this: ...原创 2019-08-12 16:57:07 · 155 阅读 · 0 评论 -
POJ 3046 Ant Counting dp 经典多重集合数问题模型 优化递推关系式
DescriptionBessie was poking around the ant hill one day watching the ants march to and fro while gathering food. She realized that many of the ants were siblings, indistinguishable from one another...原创 2019-08-15 20:34:43 · 269 阅读 · 0 评论 -
AOJ 2200 Mr. Rito Post Office Floyd+DP
题目链接题目是日文的。。。下面是参考的其他博客中的题目大意:你有一个当邮递员的好基友利腾桑遇到麻烦了:全岛有一些镇子通过水路和旱路相连,走水路必须要用船,在X处下船了船就停在X处。而且岛上只有一条船,下次想走水路还是得回到X处才行;两个镇子之间可能有两条以上的水路或旱路;邮递员必须按照清单上的镇子顺序送快递(镇子可能重复,并且对于重复的镇子不允许一次性处理,比如ABCB的话B一定要按顺序走...原创 2019-08-25 10:33:29 · 269 阅读 · 0 评论 -
POJ 1664 放苹果 计数问题的DP 划分数问题模板
Description把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法。Input第一行是测试数据的数目t(0 <= t <= 20)。以下每行均包含二个整数M和N,以空格分开。1<=M,N<=10。Output对输入的每组数据M和N,用一行输出相应的K。Sample Inpu...原创 2019-08-15 10:37:53 · 172 阅读 · 0 评论 -
POJ 2184 Cow Exhibition 0-1背包变种之处理负值 dp循环方向理解
题目链接Description“Fat and docile, big and dumb, they look so stupid, they aren’t muchfun…”-Cows with Guns by Dana LyonsThe cows want to prove to the public that they are both smart and fun. In ord...原创 2019-08-19 22:13:21 · 194 阅读 · 0 评论 -
POJ 1276 Cash Machine 多重部分和模板题 动态规划
DescriptionA Bank plans to install a machine for cash withdrawal. The machine is able to deliver appropriate @ bills for a requested cash amount. The machine uses exactly N distinct bill denominatio...原创 2019-08-14 20:04:47 · 160 阅读 · 0 评论 -
POJ 1742 Coins 动态规划 多重部分和问题 解题模板
DescriptionPeople in Silverland use coins.They have coins of value A1,A2,A3…An Silverland dollar.One day Tony opened his money-box and found there were some coins.He decided to buy a very nice watch...原创 2019-08-14 16:48:21 · 299 阅读 · 0 评论 -
POJ 2392 Space Elevator 多重部分和问题变种
DescriptionThe cows are going to space! They plan to achieve orbit by building a sort of space elevator: a giant tower of blocks. They have K (1 <= K <= 400) different types of blocks with whi...原创 2019-08-19 16:49:02 · 179 阅读 · 0 评论 -
POJ 3666 Making the Grade DP+离散化思想
DescriptionA straight dirt road connects two fields on FJ’s farm, but it changes elevation more than FJ would like. His cows do not mind climbing up or down a single slope, but they are not fond of ...原创 2019-08-19 11:05:16 · 205 阅读 · 0 评论 -
POJ 3280 Cheapest Palindrome 经典回文串DP 回文串问题阶段性小结
DescriptionKeeping track of all the cows can be a tricky task so Farmer John has installed a system to automate it. He has installed on each cow an electronic ID tag that the system will read as the...原创 2019-08-13 21:52:20 · 228 阅读 · 0 评论 -
Coincidence (九度教程第98题) 最长公共子序列(LCS) 动态规划
Find a longest common subsequence of two strings.输入描述:First and second line of each input case contain two strings of lowercase character a…z. There are no spaces before, inside or after the string...原创 2019-08-13 20:23:11 · 218 阅读 · 0 评论 -
POJ 3616 Milking Time DP(带权重的区间动态规划)
DescriptionBessie is such a hard-working cow. In fact, she is so focused on maximizing her productivity that she decides to schedule her next N (1 ≤ N ≤ 1,000,000) hours (conveniently labeled 0…N-1)...原创 2019-08-13 16:55:44 · 433 阅读 · 0 评论 -
POJ 1631 Bridging signals 最长上升子序列小结 LIS的O(nlogn)算法
POJ 1631 Bridging signals题目分析:题目要求避免相交,则可转化为对给定的序列求最长上升子序列。首先使用了dp来求解,复杂度为O(n*n),在题目的数据范围下超时了…#include<iostream>#include<stdio.h>#include<algorithm>using namespace std;int dp...原创 2019-08-18 12:30:58 · 256 阅读 · 0 评论