随笔分类 -  动态规划

上一页 1 2 3 下一页

hdu 1712 ACboy needs your help
摘要:ACboy needs your helpTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2793Accepted Submission(s): 1441 Problem DescriptionACboy has N courses this term, and he plans to spend at most M days on study.Of course,the profit he will gain from different 阅读全文

posted @ 2013-07-09 16:54 江财小子 阅读(207) 评论(0) 推荐(0)

hdu 1244 Max Sum Plus Plus Plus
摘要:Max Sum Plus Plus PlusTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 946Accepted Submission(s): 467 Problem Description给定一个由n个正整数组成的整数序列a1 a2 a3 ... an求按先后次序在其中取m段长度分别为l1、l2、l3...lm的不交叠的连续整数的和的最大值。Input第一行是一个整数n(0 ≤ n ≤ 1000),n = 0表示输入结束 第二行的第一个数 阅读全文

posted @ 2013-07-09 16:05 江财小子 阅读(292) 评论(0) 推荐(0)

hdu 2955 Robberies
摘要:RobberiesTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 7351Accepted Submission(s): 2762 Problem DescriptionThe aspiring Roy the Robber has seen a lot of American movies, and knows that the bad guys usually gets caught in the end, often because t 阅读全文

posted @ 2013-07-09 14:57 江财小子 阅读(1007) 评论(0) 推荐(0)

hdu 2844 Coins
摘要:CoinsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4893 Accepted Submission(s): 2001Problem DescriptionWhuacmers use coins.They have coins of value A1,A2,A3...An Silverland dollar. One day Hibix opened purse and found there were some coins... 阅读全文

posted @ 2013-07-09 10:19 江财小子 阅读(285) 评论(0) 推荐(0)

hdu 2159 FATE
摘要:FATETime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 5263Accepted Submission(s): 2377 Problem Description最近xhd正在玩一款叫做FATE的游戏,为了得到极品装备,xhd在不停的杀怪做任务。久而久之xhd开始对杀怪产生的厌恶感,但又不得不通过杀怪来升完这最后一级。现在的问题是,xhd升掉最后一级还需n的经验值,xhd还留有m的忍耐度,每杀一个怪xhd会得到相应的经验,并减掉相应的忍耐度。当 阅读全文

posted @ 2013-07-09 10:16 江财小子 阅读(242) 评论(0) 推荐(0)

hdu 3033 I love sneakers!
摘要:I love sneakers!Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2884Accepted Submission(s): 1180 Problem DescriptionAfter months of hard working, Iserlohn finally wins awesome amount of scholarship. As a great zealot of sneakers, he decides to spe 阅读全文

posted @ 2013-07-09 10:12 江财小子 阅读(306) 评论(0) 推荐(0)

hdu 2639 Bone Collector II
摘要:Bone Collector IITime Limit: 5000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1334Accepted Submission(s): 666 Problem DescriptionThe title of this problem is familiar,isn't it?yeah,if you had took part in the "Rookie Cup" competition,you must hav 阅读全文

posted @ 2013-07-09 10:00 江财小子 阅读(289) 评论(0) 推荐(0)

uestc 1012 饭卡
摘要:饭卡(card)Time Limit: 1000 ms Memory Limit: 65535 kB Solved: 253 Tried: 2169 SubmitStatusBest SolutionBackDescription 电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额。如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买 后卡上余额为负),否则无法购买(即使金额足够)。所以大家都希望尽量使卡上的余额最少。某天,食堂中有n种菜出售,每种菜可购买一次。已知每种菜的价格以及卡上的余额,问最少可使卡上的余额为多少。 ... 阅读全文

posted @ 2013-04-22 17:59 江财小子 阅读(510) 评论(0) 推荐(0)

poj 1192 最优连通子集
摘要:最优连通子集Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 1940 Accepted: 1018Description众所周知,我们可以通过直角坐标系把平面上的任何一个点P用一个有序数对(x, y)来唯一表示,如果x, y都是整数,我们就把点P称为整点,否则点P称为非整点。我们把平面上所有整点构成的集合记为W。定义1 两个整点P1(x1, y1), P2(x2, y2),若|x1-x2| + |y1-y2| = 1,则称P1, P2相邻,记作P1~P2,否则称P1, P2不相邻。定义 2 设点集S... 阅读全文

posted @ 2012-11-19 17:02 江财小子 阅读(276) 评论(0) 推荐(0)

POJ 1141 Brackets Sequence
摘要:Brackets SequenceTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 19636Accepted: 5437Special JudgeDescriptionLet us define a regular brackets sequence in the following way: 1. Empty sequence is a regular sequence.2. If S is a regular sequence, then (S) and [S] are both regular sequences.3. I 阅读全文

posted @ 2012-08-08 19:05 江财小子 阅读(190) 评论(0) 推荐(0)

POJ 4045 Power Station
摘要:// 给你一颗树,求一个点,使树上所有点到该点的距离之和最小。//上次金华邀请赛的题目//当时基本没接触过树形DP,连这么经典的都不会//今天写了下、居然排第4,1A,唉、、、//2次DFS,其中的道理在本子上划划就可以明白其中道理#include #include #include #include #include #define N 50005using namespace std;struct Edge{ int to,next;}ed[N<<1];__int64 sd[N];int vc[N];int node[N];int rc[1000],p;__int64 Min; 阅读全文

posted @ 2012-08-05 12:13 江财小子 阅读(319) 评论(0) 推荐(0)

ZOJ Problem Set - 3632 Watermelon Full of Water
摘要:ZOJ Problem Set - 3632Watermelon Full of WaterTime Limit: 3 Seconds Memory Limit: 65536 KBWatermelon is very popular in the hot summer. Students in ZJU-ICPC Team also love watermelon very much and they hope that they can have watermelon to eat every day during the summer vacation. Suppose there a... 阅读全文

posted @ 2012-08-05 10:20 江财小子 阅读(483) 评论(0) 推荐(0)

ZOJ Problem Set - 3623 Battle Ships
摘要:Battle ShipsTime Limit: 2 Seconds Memory Limit: 65536 KBBattle Ships is a new game which is similar to Star Craft. In this game, the enemy builds a defense tower, which has L longevity. The player has a military factory, which can produce N kinds of battle ships. The factory takes ti seconds to p... 阅读全文

posted @ 2012-08-04 20:09 江财小子 阅读(540) 评论(0) 推荐(0)

ZOJ Problem Set - 3626 Treasure Hunt I
摘要:ZOJ Problem Set - 3626Treasure Hunt ITime Limit: 2 Seconds Memory Limit: 65536 KBAkiba is a dangerous country since a bloodsucker living there. Sometimes the bloodsucker will appear and kill everyone who isn't at his hometown. One day, a brave person named CC finds a treasure map, and he wants t 阅读全文

posted @ 2012-08-04 17:28 江财小子 阅读(275) 评论(0) 推荐(0)

hdu 1561 The more, The Better
摘要:The more, The BetterTime Limit: 6000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2850Accepted Submission(s): 1684Problem DescriptionACboy很喜欢玩一种战略游戏,在一个地图上,有N座城堡,每座城堡都有一定的宝物,在每次游戏中ACboy允许攻克M个城堡并获得里面的宝物。但由于地理位置原因,有些城堡不能直接攻克,要攻克这些城堡必须先攻克其他某一个特定的城堡。你能帮ACboy算出要获得尽量多 阅读全文

posted @ 2012-08-04 12:59 江财小子 阅读(513) 评论(0) 推荐(0)

POJ 2342 Anniversary party
摘要:// 题意: 每个节点有权值,子节点和父节点不能同时选,问最后能选的最大价值是多少?// 那么每个点就有两种选择 选或不选了//第一道树形DP,虽然1Y了、不过好慢//HDu上这题居然是多组数据、然后我就超时了、表示还要好好研究//我感觉我不怎么会建树、、#include #include #include #include #include #include #define N 6002using namespace std;vector v[N];bool b[N];int dp[N][2],hp[N];void dfs(int k){ int i,len=v[k].size();... 阅读全文

posted @ 2012-08-04 09:50 江财小子 阅读(490) 评论(0) 推荐(0)

hdu 1069 Monkey and Banana
摘要:Monkey and BananaTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3987Accepted Submission(s): 2053Problem 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, an 阅读全文

posted @ 2012-08-01 13:51 江财小子 阅读(1335) 评论(0) 推荐(0)

POJ 2533 Longest Ordered Subsequence
摘要:Longest Ordered SubsequenceTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 23690Accepted: 10236DescriptionA numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence of the given numeric sequence (a1, a2, ..., aN) be any sequence (ai1, ai2, ..., aiK), where 1 < 阅读全文

posted @ 2012-08-01 11:52 江财小子 阅读(167) 评论(0) 推荐(0)

hdu 1081 To The Max
摘要:To The MaxTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4825Accepted Submission(s): 2281Problem 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 locat 阅读全文

posted @ 2012-08-01 11:01 江财小子 阅读(165) 评论(0) 推荐(0)

hdu 2182 Frog
摘要:FrogTime Limit: 3000/1000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 492Accepted Submission(s): 221Problem DescriptionA little frog named Fog is on his way home. The path's length is N (1 <= N <= 100), and there are many insects along the way. Suppose the 阅读全文

posted @ 2012-07-26 09:14 江财小子 阅读(294) 评论(0) 推荐(0)

上一页 1 2 3 下一页