
动态规划
文章平均质量分 66
Twillz
这个作者很懒,什么都没留下…
展开
-
HDU 1003 Max Sum
Max SumTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 243667 Accepted Submission(s): 57534Problem DescriptionGiven a sequenc原创 2017-05-10 13:21:15 · 291 阅读 · 0 评论 -
Coins (多重背包)
Whuacmers use coins.They have coins of value A1,A2,A3…An Silverland dollar. One day Hibix opened purse and found there were some coins. He decided to buy a very nice watch in a nearby shop. He wanted t原创 2017-07-22 20:30:17 · 440 阅读 · 0 评论 -
FATE (完全背包)
最近xhd正在玩一款叫做FATE的游戏,为了得到极品装备,xhd在不停的杀怪做任务。久而久之xhd开始对杀怪产生的厌恶感,但又不得不通过杀怪来升完这最后一级。现在的问题是,xhd升掉最后一级还需n的经验值,xhd还留有m的忍耐度,每杀一个怪xhd会得到相应的经验,并减掉相应的忍耐度。当忍耐度降到0或者0以下时,xhd就不会玩这游戏。xhd还说了他最多只杀s只怪。请问他能升掉这最后一级吗? Inpu原创 2017-07-22 20:58:56 · 485 阅读 · 0 评论 -
Bottles(选择k个物品的01背包)
Nick has n bottles of soda left after his birthday. Each bottle is described by two values: remaining amount of soda ai and bottle volume bi (ai ≤ bi).Nick has decided to pour all remaining soda into m原创 2017-07-22 21:18:55 · 940 阅读 · 0 评论 -
背包输出路径
#include #include #include #include #include #define maxn 1010using namespace std;typedef long long ll;ll v[maxn];ll w[maxn];int n,p;ll dp[maxn];int pre[maxn];int main(){ int t;原创 2017-07-22 21:47:15 · 374 阅读 · 0 评论 -
HDU 1260 Tickets(DP)
TicketsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4513 Accepted Submission(s): 2320Problem Description Jesus, what a great movie! Thou原创 2017-07-23 10:58:46 · 288 阅读 · 0 评论 -
POJ 1745 Divisiblity
Divisibility Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 12386 Accepted: 4421 DescriptionConsider an arbitrary sequence of integers. One can place + or - operators between原创 2017-07-23 19:52:32 · 280 阅读 · 0 评论 -
POJ 3186 Treat for the Cows(区间dp)
Treats for the Cows Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6163 Accepted: 3208 DescriptionFJ has purchased N (1 <= N <= 2000) yummy treats for the cows who get money for原创 2017-07-23 20:49:54 · 297 阅读 · 0 评论 -
Tree Cutting 树形dp
After Farmer John realized that Bessie had installed a “tree-shaped” network among his N (1 <= N <= 10,000) barns at an incredible cost, he sued Bessie to mitigate his losses. Bessie, feeling vindictiv原创 2017-07-26 22:47:12 · 341 阅读 · 0 评论 -
Anniversary Party(树形dp)
Anniversary party Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8765 Accepted: 5031 DescriptionThere is going to be a party to celebrate the 80-th Anniversary of the Ural State原创 2017-07-26 23:25:12 · 285 阅读 · 0 评论 -
God Father (树形dp 树的重心)
Last years Chicago was full of gangster fights and strange murders. The chief of the police got really tired of all these crimes, and decided to arrest the mafia leaders.Unfortunately, the structure of原创 2017-07-27 15:58:17 · 351 阅读 · 0 评论 -
Contestant Division(树形dp)
In the new ACM-ICPC Regional Contest, a special monitoring and submitting system will be set up, and students will be able to compete at their own universities. However there’s one problem. Due to the翻译 2017-07-27 21:31:59 · 291 阅读 · 0 评论 -
Puzzles (树形dp+组合数学)
Barney lives in country USC (United States of Charzeh). USC has n cities numbered from 1 through n and n - 1 roads between them. Cities and roads of USC form a rooted tree (Barney’s not sure why it is原创 2017-07-28 13:56:52 · 454 阅读 · 0 评论 -
HDU1864 最大报销费用(01背包)
现有一笔经费可以报销一定额度的发票。允许报销的发票类型包括买图书(A类)、文具(B类)、差旅(C类),要求每张发票的总额不得超过1000元,每张发票上,单项物品的价值不得超过600元。现请你编写程序,在给出的一堆发票中找出可以报销的、不超过给定额度的最大报销额。 Input 测试输入包含若干测试用例。每个测试用例的第1行包含两个正数 Q 和 N,其中 Q 是给定的报销额度,N(<=30)是发票原创 2017-07-22 19:58:00 · 418 阅读 · 0 评论 -
Robberies(DP之01背包)
The 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 they become too greedy. He has decided to work in the lucrative原创 2017-07-22 15:26:43 · 374 阅读 · 0 评论 -
HDU 1024(DP+滚动数组)
Max Sum Plus PlusTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 29920 Accepted Submission(s): 10505Problem Description Now I think you hav原创 2017-07-20 19:07:32 · 355 阅读 · 0 评论 -
HDU 1257 最少导弹拦截系统(DP)
最少拦截系统Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 43044 Accepted Submission(s): 16763Problem Description 某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种原创 2017-07-20 20:21:53 · 469 阅读 · 0 评论 -
HDU 1069 Monkey and Banana(DP)
Monkey and BananaTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 15479 Accepted Submission(s): 8198Problem Description A group of researche原创 2017-07-20 22:06:11 · 289 阅读 · 0 评论 -
HDU 1087 (DP---最大递增子序列和)
Super Jumping! Jumping! Jumping!Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 39083 Accepted Submission(s): 17958Problem Description Nowa原创 2017-07-20 22:35:05 · 298 阅读 · 0 评论 -
Light OJ 1005 Rooks
1005 - Rooks PDF (English) Statistics Forum Time Limit: 1 second(s) Memory Limit: 32 MB A rook is a piece used in the game of chess which is played on a board of square grids. A rook can原创 2017-07-21 08:11:43 · 350 阅读 · 0 评论 -
HDU 1114 Piggy Bank(完全背包)
Piggy-BankTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 25594 Accepted Submission(s): 12976Problem Description Before ACM can do anything原创 2017-07-21 11:27:13 · 283 阅读 · 0 评论 -
Cash Machine (多重背包)
A 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 denominations, say Dk, k=原创 2017-07-21 13:30:55 · 360 阅读 · 0 评论 -
Boredom (DP)
Alex doesn’t like boredom. That’s why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers.原创 2017-07-21 18:55:17 · 592 阅读 · 0 评论 -
Sonya and A Problem without A Legend(DP+优化)
Sonya was unable to think of a story for this problem, so here comes the formal description.You are given the array containing n positive integers. At one turn you can pick any element and increase or原创 2017-07-21 22:40:25 · 518 阅读 · 0 评论 -
poj 1458 LCS(最长公共子序列)
Common Subsequence Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 53343 Accepted: 22124 DescriptionA subsequence of a given sequence is the given sequence with some elements原创 2017-07-21 23:15:37 · 278 阅读 · 0 评论 -
HDU 1176 免费馅饼 (DP)
免费馅饼Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 50035 Accepted Submission(s): 17341Problem Description 都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽原创 2017-07-22 01:02:43 · 353 阅读 · 0 评论 -
POJ 3249 (DAG)
Test for Job Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 11150 Accepted: 2630 DescriptionMr.Dog was fired by his company. In order to support his family, he must find a ne原创 2017-07-18 22:40:38 · 338 阅读 · 0 评论 -
HDU 1074 Doing Homework(状压dp+记录路径)
Doing HomeworkTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 10363 Accepted Submission(s): 4997Problem Description Ignatius has just come原创 2017-11-13 19:25:25 · 257 阅读 · 0 评论