![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
DP
文章平均质量分 73
tokers
所有的魅力在“习惯”面前都将无色。
展开
-
2014年04月10日
背包9讲——01背包问题 一般来说,01背包都是基于这样一类问题,有一个容器,它有一个容量V,然后有n种物品,每种物品有且仅有一件,含有属性v(比如说重量),w(价值),问怎么放物品,使得背包内的物品的价值和最大(注意不能超容量)在这里我要介绍一种优化过的一维数组的做法 用dp[i]来表示当抉择到第i种物品是,所拥有的价值总量 那么显然,状态转移方程即为原创 2014-08-05 10:41:20 · 570 阅读 · 0 评论 -
2014年04月10日
背包九讲——完全背包 题目是这样的:有一个容量为V的容器,有n种物品,每种物品数量无限多,分别有两个属性,价值v和代价c,问如何选择物品,似的背包内的物品的价值最大? 介绍下完全背包,与01背包不同的地方在与:每种物品的数量变成了无限多,那在抉择某种物品时,方案由无限多:不选,选一件,两件..... 状态转移方程: (同样也是优化过的)原创 2014-08-05 10:41:22 · 503 阅读 · 0 评论 -
2014年04月10日
背包九讲——多重背包 题目是这样的,有一个容积为V的容器,有n种物品,每种物品有m件,同样具有代价c和价值v两种属性,问如何抉择可使背包里的价值最大? 我们需要把问题转化为01背包或是完全背包,怎么转,先给代码 多重背包函数: void duochonbag(int amount,in原创 2014-08-05 10:41:24 · 495 阅读 · 0 评论 -
hdu2512——一卡通大冒险
一卡通大冒险Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1383 Accepted Submission(s): 914Problem Description因为长期钻研算法, 无暇顾及个人问题,BUAA原创 2014-09-18 00:10:23 · 857 阅读 · 0 评论 -
HDU1565——方格取数(1)
方格取数(1)Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5726 Accepted Submission(s): 2167Problem Description给你一个n*n的格子的棋盘,每个格子里面有原创 2014-10-21 18:03:25 · 705 阅读 · 0 评论 -
POJ1185——炮兵阵地
炮兵阵地Time Limit: 2000MS Memory Limit: 65536KTotal Submissions: 19782 Accepted: 7651Description司令部的将军们打算在N*M的网格地图上部署他们的炮兵部队。一个N*M的地图由N行M列组成,地图的每一格可能是山地(用"H" 表示),也可能是平原创 2014-10-22 21:39:50 · 835 阅读 · 0 评论 -
POJ1157——LITTLE SHOP OF FLOWERS
LITTLE SHOP OF FLOWERSTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 18481 Accepted: 8512DescriptionYou want to arrange the window of your flower shop in原创 2014-11-07 14:56:55 · 1647 阅读 · 0 评论 -
hdu2167——Pebbles
PebblesTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1136 Accepted Submission(s): 661Problem DescriptionYou're given an unlimit原创 2014-10-22 16:49:27 · 1005 阅读 · 0 评论 -
POJ2955——Brackets
BracketsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 3341 Accepted: 1717DescriptionWe give the following inductive definition of a “regular brackets”原创 2014-11-09 20:30:08 · 655 阅读 · 0 评论 -
NYOJ737——石子合并(1)
石子合并(一)时间限制:1000 ms | 内存限制:65535 KB难度:3描述 有N堆石子排成一排,每堆石子有一定的数量。现要将N堆石子并成为一堆。合并的过程只能每次将相邻的两堆石子堆成一堆,每次合并花费的代价为这两堆石子的和,经过N-1次合并后成为一堆。求出总的代价最小值。输入有多组测试数据,输入到文件结束。每组测试数据第一行有一个整数n,表示有n堆石子。原创 2014-11-09 19:56:04 · 868 阅读 · 0 评论 -
POJ1651——Multiplication Puzzle
Multiplication PuzzleTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6511 Accepted: 3964DescriptionThe multiplication puzzle is played with a row of cards原创 2014-11-10 20:33:44 · 751 阅读 · 0 评论 -
POJ3254——Corn Fields
Corn FieldsTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 8186 Accepted: 4362DescriptionFarmer John has purchased a lush new rectangular pasture compos原创 2014-10-24 19:26:21 · 637 阅读 · 0 评论 -
POJ2411——Mondriaan's Dream
Mondriaan's DreamTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 12042 Accepted: 7011DescriptionSquares and rectangles fascinated the famous Dutch painter原创 2014-10-25 00:18:41 · 680 阅读 · 0 评论 -
POJ3661——Running
RunningTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 5232 Accepted: 1938DescriptionThe cows are trying to become better athletes, so Bessie is runni原创 2014-11-11 22:13:13 · 760 阅读 · 0 评论 -
POJ1014——Dividing
DividingTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 60332 Accepted: 15567DescriptionMarsha and Bill own a collection of marbles. They want to split th原创 2014-10-27 20:32:11 · 766 阅读 · 0 评论 -
POJ2250——Compromise
CompromiseTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6614 Accepted: 2957 Special JudgeDescriptionIn a few months the European Currency Union will原创 2014-11-13 20:57:07 · 784 阅读 · 0 评论 -
POJ1836——Alignment
AlignmentTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 13366 Accepted: 4296DescriptionIn the army, a platoon is composed by n soldiers. During the morni原创 2014-10-28 20:33:35 · 1150 阅读 · 0 评论 -
POJ2137——Cowties
CowtiesTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2870 Accepted: 961DescriptionN cows (3 <= N <= 100) are eating grass in the middle of a field. So t原创 2014-10-28 17:19:23 · 774 阅读 · 0 评论 -
POJ3132——Sum of Different Primes
Sum of Different PrimesTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 3243 Accepted: 2016DescriptionA positive integer may be expressed as a sum of dif原创 2014-11-14 21:43:20 · 781 阅读 · 0 评论 -
hdu2151——Worm
WormTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2803 Accepted Submission(s): 1801Problem Description自从见识了平安夜苹果的涨价后,Lele就在他家门口原创 2014-11-15 12:11:46 · 927 阅读 · 0 评论 -
hdu3001——Travelling 三进制TSP, 状态压缩
TravellingTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4106 Accepted Submission(s): 1310Problem DescriptionAfter coding so man原创 2014-11-16 17:00:33 · 1069 阅读 · 0 评论 -
hdu1506——Largest Rectangle in a Histogram
Largest Rectangle in a HistogramTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12019 Accepted Submission(s): 3326Problem Descripti原创 2014-11-17 09:32:39 · 847 阅读 · 0 评论 -
POJ2241——The Tower of Babylon
The Tower of BabylonTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2207 Accepted: 1244DescriptionPerhaps you have heard of the legend of the Tower of Bab原创 2014-11-01 04:09:17 · 1236 阅读 · 0 评论 -
POJ3356——AGTC
AGTCTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 10218 Accepted: 3946DescriptionLet x and y be two strings over some finite alphabet A. We would like原创 2014-10-31 23:12:52 · 1066 阅读 · 0 评论 -
POJ3230——Travel
TravelTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 4185 Accepted: 1758DescriptionOne traveler travels among cities. He has to pay for this while he c原创 2014-10-31 21:39:12 · 924 阅读 · 0 评论 -
POJ1159——Palindrome
PalindromeTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 53647 Accepted: 18522DescriptionA palindrome is a symmetrical string, that is, a string read ide原创 2014-11-01 16:56:46 · 1069 阅读 · 0 评论 -
POJ3342——Party at Hali-Bula
Party at Hali-BulaTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 5418 Accepted: 1920DescriptionDear Contestant,I'm going to have a party at my vill原创 2014-10-31 16:45:06 · 1246 阅读 · 0 评论 -
Codeforces Round #260 (Div. 2)——C. Boredom
C. Boredomtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlex doesn't like boredom. That's why whenever he gets bore原创 2014-10-31 20:50:34 · 1378 阅读 · 0 评论 -
POJ2663——Tri Tiling
Tri TilingTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 7915 Accepted: 4148DescriptionIn how many ways can you tile a 3xn rectangle with 2x1 dominoes?原创 2014-11-02 19:45:25 · 743 阅读 · 0 评论 -
POJ2378——Tree Cutting
Distance StatisticsTime Limit: 2000MS Memory Limit: 64000KTotal Submissions: 1660 Accepted: 528Case Time Limit: 1000MSDescriptionFrustrated at the number of d原创 2014-11-03 18:37:51 · 906 阅读 · 0 评论 -
hdu1176——免费馅饼
免费馅饼Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 26120 Accepted Submission(s): 8911Problem Description都说天上不会掉馅饼,但有一天gameboy正走在原创 2014-10-17 15:01:08 · 615 阅读 · 0 评论 -
hdu1561——The more, The Better
The more, The BetterTime Limit: 6000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5472 Accepted Submission(s): 3251Problem DescriptionACboy很喜欢玩原创 2014-11-02 16:07:08 · 719 阅读 · 0 评论 -
POJ3107——Godfather
GodfatherTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 4853 Accepted: 1671DescriptionLast years Chicago was full of gangster fights and strange murder原创 2014-11-03 18:25:59 · 916 阅读 · 0 评论 -
POJ1741——Tree 基于点的分治
TreeTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 11229 Accepted: 3515DescriptionGive a tree with n vertices,each edge has a length(positive integer les原创 2014-11-04 21:35:20 · 822 阅读 · 0 评论 -
POJ2385——Apple Catching
Apple CatchingTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 8062 Accepted: 3951DescriptionIt is a little known fact that cows love apples. Farmer John h原创 2014-11-25 17:00:54 · 851 阅读 · 0 评论 -
POJ3311——Hie with the Pie
Hie with the PieTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 4646 Accepted: 2457DescriptionThe Pizazz Pizzeria prides itself in delivering pizzas to原创 2014-11-04 10:33:53 · 1071 阅读 · 0 评论 -
hdu2159——FATE
FATETime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8296 Accepted Submission(s): 3879Problem Description最近xhd正在玩一款叫做FATE的游戏,为了得到极原创 2014-11-26 20:53:49 · 699 阅读 · 0 评论 -
hdu2845——Beans
BeansTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3011 Accepted Submission(s): 1450Problem DescriptionBean-eating is an intere原创 2014-11-26 21:21:43 · 799 阅读 · 0 评论 -
POJ1191——棋盘分割
棋盘分割Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 12456 Accepted: 4389Description将一个8*8的棋盘进行如下分割:将原棋盘割下一块矩形棋盘并使剩下部分也是矩形,再将剩下的部分继续如此分割,这样割了(n-1)次后,连同最后剩下原创 2014-11-26 20:24:40 · 901 阅读 · 0 评论 -
POJ1745——Divisibility
DivisibilityTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 10485 Accepted: 3738DescriptionConsider an arbitrary sequence of integers. One can place + or原创 2014-11-23 15:31:22 · 841 阅读 · 0 评论