动态规划
KeepTing
java开发工程师
展开
-
Zipper(动态规划)
Given three strings, you are to determine whether the third string can be formed by combining the characters in the first two strings. The first two strings can be mixed arbitrarily, but each must sta原创 2015-08-15 17:30:40 · 1004 阅读 · 0 评论 -
hdu 2602 Bone Collector (0-1背包)
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 as dog’s , cow’s , also he went to the grave原创 2015-09-07 21:14:03 · 370 阅读 · 0 评论 -
hdu 2084 数塔(动态规划)
Problem Description在讲述DP算法的时候,一个经典的例子就是数塔问题,它是这样描述的:有如下所示的数塔,要求从顶层走到底层,若每一步只能走到相邻的结点,则经过的结点的数字之和最大是多少?已经告诉你了,这是个DP的题目,你能AC吗?Input输入数据首先包括一个整数C,表示测试实例的个数,每个测试实例的第一行是一个整数N(1原创 2015-09-07 21:16:56 · 279 阅读 · 0 评论 -
hdu 1081 To The Max最大矩阵和(动态规划)
Problem DescriptionGiven a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1 x 1 or greater located within the whole array. The sum of a原创 2015-09-07 21:27:15 · 300 阅读 · 0 评论 -
HDU 2151 Worm (动态规划)
Problem Description自从见识了平安夜苹果的涨价后,Lele就在他家门口水平种了一排苹果树,共有N棵。突然Lele发现在左起第P棵树上(从1开始计数)有一条毛毛虫。为了看到毛毛虫变蝴蝶的过程,Lele在苹果树旁观察了很久。虽然没有看到蝴蝶,但Lele发现了一个规律:每过1分钟,毛毛虫会随机从一棵树爬到相邻的一棵树上。比如刚开始毛毛虫在第2棵树上,过1分钟后,毛毛原创 2016-02-05 20:32:20 · 389 阅读 · 0 评论 -
HDU 1260 Tickets (DP)
Problem DescriptionJesus, what a great movie! Thousands of people are rushing to the cinema. However, this is really a tuff time for Joe who sells the film tickets. He is wandering when could he go原创 2016-03-06 09:30:10 · 229 阅读 · 0 评论 -
0-1背包问题(动态规划)
#include int main (){ int n,m; int w[100],p[100]; int i,j; int c[100][100]; scanf("%d%d",&n,&m); //输入背包容量 for (i=1;i<=m;i++) { scanf ("%d",&w[i]); scanf ("%d",&p[i]); } for原创 2015-06-13 08:36:51 · 385 阅读 · 0 评论 -
hdu 1059 Dividing(多重背包)
Problem DescriptionMarsha and Bill own a collection of marbles. They want to split the collection among themselves so that both receive an equal share of the marbles. This would be easy if all the m原创 2015-09-07 21:21:48 · 290 阅读 · 0 评论 -
最长子段和(动态规划)
#includeint main (){ int n,m,b; int flag1,temp1,temp2,flag2; int a[1000]; int i,k,sum; scanf ("%d",&n); for (k=1;k<=n;k++) { temp1=temp2=0; flag1=flag2=0; b=0; scanf ("%d",&m); for原创 2015-06-06 16:54:31 · 951 阅读 · 0 评论 -
Piggy-Bank(完全背包)
Problem DescriptionBefore ACM can do anything, a budget must be prepared and the necessary financial support obtained. The main income for this action comes from Irreversibly Bound Money (IBM). The原创 2015-08-16 10:23:27 · 365 阅读 · 0 评论 -
hdu 1500 Chopsticks(动态规划)
Problem DescriptionIn China, people use a pair of chopsticks to get food on the table, but Mr. L is a bit different. He uses a set of three chopsticks -- one pair, plus an EXTRA long chopstick to ge原创 2015-09-07 21:10:05 · 430 阅读 · 0 评论