动态规划
Albert_Bolt
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
杭电1423(最长递增公共子序列 LICS)
Greatest Common Increasing SubsequenceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionThis is a problem from ZOJ 2432.To make it easyer,you ju...原创 2018-07-18 11:42:21 · 350 阅读 · 0 评论 -
杭电2829(斜率dp)
LawrenceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionT. E. Lawrence was a controversial figure during World War I. He was a British officer...原创 2018-08-14 16:11:13 · 289 阅读 · 0 评论 -
杭电1074(交作业+状态压缩)
Doing Homework(难度:1)Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionIgnatius has just come back school from the 30th ACM/ICPC. Now he has a lo...原创 2018-08-02 14:59:22 · 390 阅读 · 0 评论 -
杭电1087(和最大的递增子序列)
Super Jumping! Jumping! Jumping!(难度:1)Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionNowadays, a kind of chess game called “Super Jumping! Ju...原创 2018-08-03 09:47:18 · 625 阅读 · 0 评论 -
杭电1078(仓鼠吃奶酪,DFS+动态规划)
FatMouse and CheeseTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionFatMouse has stored some cheese in a city. The city can be considered as a ...原创 2018-08-02 21:05:46 · 1221 阅读 · 0 评论 -
杭电1114(完全背包)
Piggy-Bank(难度:1)Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionBefore ACM can do anything, a budget must be prepared and the necessary fina...原创 2018-08-03 10:50:37 · 482 阅读 · 0 评论 -
杭电3045(斜率dp)
Picnic CowsTime Limit: 8000/4000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionIt’s summer vocation now. After tedious milking, cows are tired and wish to take a ...原创 2018-08-15 16:05:37 · 256 阅读 · 0 评论 -
杭电1158(公司雇人)
Employment Planning(难度:1)Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionA project manager wants to determine the number of the workers needed...原创 2018-08-08 11:40:27 · 298 阅读 · 0 评论 -
杭电2993 && POJ2018(斜率dp)
MAX Average ProblemTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionConsider a simple sequence which only contains positive integers as a1, a2 ...原创 2018-08-15 22:39:08 · 313 阅读 · 0 评论 -
背包问题
一、01背包题目有n件物品,容量为V的背包放入第 i 件物品耗费的费用是ci,得到的价值是wi求解将哪些物品装入背包可使价值总和最大特点每种物品仅有1件,可以选择放或不放。状态转移方程dp[j]表示背包内放入物品费用为 j 时的最大价值 dp[j] = max { dp[j], dp[ j - ci ] + wi }初始化要求恰好装满背包:dp[0]=0...原创 2018-09-05 11:39:20 · 260 阅读 · 0 评论 -
杭电3507(斜率dp)
Print ArticleTime Limit: 9000/3000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others)Problem DescriptionZero has an old printer that doesn’t work well sometimes. As it is antique, he s...原创 2018-08-14 14:46:03 · 400 阅读 · 0 评论 -
状态压缩DP
讲解       对问题的状态进行压缩,将状态转化为二进制的形式,通过位运算进行操作,要注意位运算符的优先级。使用在问题规模较小时使用。位运算对x取反:~x x+1(x为偶数):x|1 2x:1<...原创 2018-08-02 10:11:56 · 237 阅读 · 0 评论 -
斜率dp
斜率dp模型给定一个序列,分成若干段,分段有一定的限制条件,并需要一定的费用,问怎样分段才能在满足限制条件的情况下,使费用最小。条件状态转移方程类似于:dp[i] = dp[j] + (x[i] - x[j]) * (x[i] - x[j])。无法转化成dp[i] = f[j] + x[i]的形式。抽象将dp[i] = dp[j] + (x[i] - x[j])...原创 2018-08-14 11:46:54 · 351 阅读 · 0 评论 -
杭电1142(dijkstra最短路+DFS记忆化搜索)
A Walk Through the ForestTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionJimmy experiences a lot of stress at work these days, especially si...原创 2018-07-18 21:58:52 · 392 阅读 · 0 评论 -
杭电1003(最大子串和)
Max Sum(难度:1)Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionGiven a sequence a[1],a[2],a[3]……a[n], your job is to calculate the max sum of a ...原创 2018-08-01 09:37:46 · 884 阅读 · 0 评论 -
杭电1025(最长上升子序列+二分查找优化)
Constructing Roads In JGShining’s Kingdom(难度:1)Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionJGShining’s kingdom consists of 2n(n is no more...原创 2018-08-01 11:02:37 · 511 阅读 · 0 评论 -
杭电1058(输出第n个humble数)
Humble NumbersTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionA number whose only prime factors are 2,3,5 or 7 is called a humble number. The ...原创 2018-08-01 14:57:25 · 321 阅读 · 0 评论 -
杭电1059(多重背包)
Dividing(难度:1)Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionMarsha and Bill own a collection of marbles. They want to split the collection a...原创 2018-08-06 11:38:59 · 329 阅读 · 0 评论 -
杭电2191(多重背包)
悼念512汶川大地震遇难同胞——珍惜现在,感恩生活Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Problem Description急!灾区的食物依然短缺! 为了挽救灾区同胞的生命,心系灾区同胞的你准备自己采购一些粮食支援灾区,现在假设你一共有资金n元,而市场有m种大...原创 2018-08-10 11:32:12 · 308 阅读 · 0 评论 -
杭电1069(按长宽从大到小往上堆高塔)
Monkey and Banana(难度:1)Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionA group of researchers are designing an experiment to test the IQ of a ...原创 2018-08-01 17:13:19 · 481 阅读 · 0 评论 -
杭电2602(01背包)
Bone Collector(难度:1)Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionMany years ago , in Teddy’s hometown there was a man who was called “Bone ...原创 2018-08-06 15:52:48 · 592 阅读 · 0 评论 -
动态规划的几个模板
错排公式dp[1]=0; dp[2]=1;for(int i=3;i<=20;i++){ dp[i]=(i-1)*dp[i-1]+(i-1)*dp[i-2];}cin>>n;cout<<dp[n]<<endl;最长递增子序列 LISfor(int i=1;i<=n;i++){ int tmax=1; ...原创 2018-09-05 15:57:20 · 664 阅读 · 0 评论
分享