
基础DP(动态规划)
基础DP(动态规划)
Guuuuuu老师儿
当初的算法竞赛题目博客的留言评论就不回复了,时间太久已经忘干净了,抱歉~
展开
-
ACM-ICPC 2018 焦作网络预赛K-Transport Ship(多重背包)
ACM-ICPC 2018 焦作网络预赛K-Transport ShipThere are NNN different kinds of transport ships on the port. The ithi^{th}ith kind of ship can carry the weight of V[i]V[i]V[i] and the number of the ithi^{th}it...原创 2018-09-16 10:29:03 · 462 阅读 · 0 评论 -
Help Jimmy (dp)
Help Jimmy "Help Jimmy" 是在下图所示的场景上完成的游戏。 场景中包括多个长度和高度各不相同的平台。地面是最低的平台,高度为零,长度无限。 Jimmy老鼠在时刻0从高于所有平台的某处开始下落,它的下落速度始终为1米/秒。当Jimmy落到某个平台上时,游...原创 2018-05-19 11:08:47 · 388 阅读 · 0 评论 -
Jury Compromise(DP)
Jury Compromise In Frobnia, a far-away country, the verdicts in court trials are determined by a jury consisting of members of the general public. Every time a trial is set to begin, a ju...原创 2018-05-19 09:57:04 · 300 阅读 · 0 评论 -
Phalanx (dp求最大对称子矩阵)
Phalanx Today is army day, but the servicemen are busy with the phalanx for the celebration of the 60th anniversary of the PRC. A phalanx is a matrix of size n*n, each element is...原创 2018-05-17 09:37:50 · 596 阅读 · 0 评论 -
CF(第八届山东省赛,01背包+贪心)
CFProblem DescriptionLYD loves codeforces since there are many Russian contests. In an contest lasting for T minutes there are n problems, and for the ith problem you can get ai−di∗ti points, where ai...原创 2018-05-03 18:28:52 · 246 阅读 · 0 评论 -
Dream City ZOJ - 3211 (贪心+dp)
Dream City ZOJ - 3211 JAVAMAN is visiting Dream City and he sees a yard of gold coin trees. There are n trees in the yard. Let's call th...原创 2018-04-20 14:10:54 · 284 阅读 · 0 评论 -
Hurdles of 110m ZOJ - 2972 (DP)
Hurdles of 110m ZOJ - 2972 In the year 2008, the 29th Olympic Games will be held in Beijing. This will signify the prosperity of China and Beijing Olympics ...原创 2018-04-18 19:23:02 · 711 阅读 · 0 评论 -
Brush (III) LightOJ - 1017(dp)
Brush (III) LightOJ - 1017Samir returned home from the contest and got angry after seeing his...原创 2018-04-12 16:45:26 · 394 阅读 · 0 评论 -
FatMouse and Cheese HDU - 1078(dp记忆化搜索)
FatMouse and Cheese HDU - 1078 FatMouse has stored some cheese in a city. The city can be considered as a square grid of dimensi...原创 2018-04-12 16:03:21 · 251 阅读 · 0 评论 -
Vacations (DP)
Vacations Vasya has n days of vacations! So he decided to improve his IT skills and do sport. Vasya knows the following information about each of this n days: whether that gym opene...原创 2018-05-13 14:15:37 · 171 阅读 · 0 评论 -
Max Sum Plus Plus (动态规划+m子段和的最大值)
Max Sum Plus Plus Now I think you have got an AC in Ignatius.L's "Max Sum" problem. To be a brave ACMer, we always challenge ourselves ...原创 2018-05-14 15:39:07 · 6545 阅读 · 1 评论 -
ACM-ICPC 2018 焦作网络预赛 B - Mathematical Curse(dp)
ACM-ICPC 2018 焦作网络预赛 B - Mathematical CurseA prince of the Science Continent was imprisoned in a castle because of his contempt for mathematics when he was young, and was entangled in some mathemati...原创 2018-09-16 08:45:57 · 469 阅读 · 0 评论 -
Least common multiple (数论+完全背包)
Least common multiple Partychen like to do mathematical problems. One day, when he was doing on a least common multiple(LCM) problem, he suddenly thought of a very interesting question: if given a n...原创 2018-08-01 20:06:38 · 919 阅读 · 0 评论 -
Yet Another Problem On a Subsequence(dp+组合数)
Yet Another Problem On a SubsequenceThe sequence of integers a1,a2,…,ak is called a good array if a1=k−1 and a1>0. For example, the sequences [3,−1,44,0],[1,−99] are good arrays, and the sequence...原创 2018-08-01 08:48:20 · 423 阅读 · 0 评论 -
Guess the number HDU - 5981 (dp推理)
Guess the number HDU - 5981 AOA just met a problem when he attended an interview, as shown below:A and B two people play guessing games. A thinks of a number x between a and b randomly in his mind,...原创 2018-07-22 14:12:37 · 633 阅读 · 0 评论 -
Seam Carving HDU - 5092(基础dp+路径还原)
题意:找到一条纵向的线,使得线经过的格子值和最小,如果值相同取最右边的。(从每个格子可以通向八个方向)输出每个格子到列号(每行1个格子)分析:从上往下遍历,当前位置可能由上一行的三个方向过来 dp[i][j]=dp[i−1][k]+a[i][j](k=j−1,j,j+1)dp[i][j]=dp[i−1][k]+a[i][j](k=j−1,j,j+1)dp[i][j] = dp[i-1...原创 2018-07-16 19:52:27 · 306 阅读 · 0 评论 -
FatMouse's Speed (贪心+最长严格符合条件子序列DP+路径还原)
FatMouse's Speed FatMouse believes that the fatter a mouse is, the faster it runs. To disprove this, you want to take the data on a collection of mice and put as large a subset of...原创 2018-05-16 19:59:47 · 437 阅读 · 0 评论 -
Making the Grade POJ - 3666(DP+离散化)
Making the Grade POJ - 3666 ...原创 2018-05-23 09:31:20 · 202 阅读 · 0 评论 -
Milking Time POJ - 3616(动态规划DP)
Milking Time POJ - 3616 ...原创 2018-05-23 08:26:33 · 322 阅读 · 0 评论 -
Permutation Counting HDU - (dp,递推)
Permutation Counting HDU - 3664 Given a permutation a1, a2, … aN of {1, 2, …, N}, we define its E-value as the amount of element...原创 2018-04-12 15:07:47 · 246 阅读 · 0 评论 -
计蒜客-划分整数(dp)
划分整数 蒜头君特别喜欢数学。今天,蒜头君突发奇想:如果想要把一个正整数 nnn 分解成不多于 kkk 个正整数相加的形式,那么一共有多少种分解的方式呢?蒜头君觉得这个问题实在是太难了,于是他想让你帮帮忙。输入格式共一行,包含两个整数 n(1≤n≤300)n(1 \leq n \leq 300)n(1≤n≤300) 和 k(1≤k≤300)k(1 \l...原创 2018-03-29 14:18:56 · 761 阅读 · 0 评论 -
循环数组最大子段和 51Nod - 1050
循环数组最大子段和 51Nod - 1050 N个整数组成的循环序列a1,a2,a3,…,an,求该序列如ai+ai+1+…+aj的连续的子段和的最大值(循环序列是指n个数围成一个圈,因此需要考虑an−1,an,a1,a2这样的序列)。当所给的整数均为负数时和为0。 例如:...原创 2018-04-03 16:37:42 · 200 阅读 · 0 评论 -
Piggy-Bank (完全背包)
Piggy-Bank Before 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 idea原创 2017-11-24 17:15:29 · 280 阅读 · 0 评论 -
Bone Collector (简单dp)
Bone Collector Many 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原创 2017-11-24 16:37:30 · 380 阅读 · 0 评论 -
The Triangle (dp)
The Triangle 73 88 1 02 7 4 44 5 2 6 5(Figure 1)Figure 1 shows a number triangle. Write a program that calculates the highest sum of numbers passed on a route that st原创 2017-11-24 16:18:17 · 266 阅读 · 0 评论 -
You're Given a String... CodeForces - 23A
You're Given a String...CodeForces - 23AYou're given a string of lower-case Latin letters. Your task is to find the length of its longest substring that can be met in the string at least原创 2017-12-03 18:57:31 · 584 阅读 · 0 评论 -
Longest Ordered Subsequence POJ - 2533(dp动态规划)
Longest Ordered SubsequencePOJ - 2533A numeric sequence of ai is ordered ifa1 a2 aN. Let the subsequence of the given numeric sequence (a1, a2, ..., aN) be any sequence (ai1, ai2, ..原创 2017-12-03 17:35:59 · 507 阅读 · 0 评论 -
Working out CodeForces - 429B (四个角dp)
Working outCodeForces - 429BSummer is coming! It's time for Iahub and Iahubina to work out, as they both want to look hot at the beach. The gym where they go is a matrixa with n lines原创 2017-12-03 10:41:05 · 410 阅读 · 0 评论 -
最大报销额 HDU 1864(01背包)
最大报销额HDU 1864现有一笔经费可以报销一定额度的发票。允许报销的发票类型包括买图书(A类)、文具(B类)、差旅(C类),要求每张发票的总额不得超过1000元,每张发票上,单项物品的价值不得超过600元。现请你编写程序,在给出的一堆发票中找出可以报销的、不超过给定额度的最大报销额。Input 测试输入包含若干测试用例。每个测试用例的第1行包含两个正数原创 2017-11-30 08:59:54 · 318 阅读 · 0 评论 -
饭卡(动态规划)
饭卡电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额。如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为负),否则无法购买(即使金额足够)。所以大家都希望尽量使卡上的余额最少。某天,食堂中有n种菜出售,每种菜可购买一次。已知每种菜的价格以及卡上的余额,问最少可使卡上的余额为多少。 Input 多组数据。对于原创 2017-11-29 21:39:37 · 1200 阅读 · 0 评论 -
Common Subsequence POJ - 1458(dp)
Common SubsequencePOJ - 1458A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = another sequence Z = is a subsequenc原创 2017-11-28 05:44:36 · 219 阅读 · 0 评论 -
Bellovin HDU - 5748 (最长上升子序列)
BellovinHDU - 5748Peter has a sequence a1,a2,...,an and he define a function on the sequence -- F(a1,a2,...,an)=(f1,f2,...,fn), where fi is the length of the longest increasing sub原创 2018-01-28 22:45:05 · 335 阅读 · 0 评论 -
最大子段和 51Nod - 1049 (on line法)
最大子段和 51Nod - 1049 N个整数组成的序列a1,a2,a3,…,an,求该序列如ai+ai+1+…+aj的连续子段和的最大值。当所给的整数均为负数时和为0。 例如:-2,11,-4,13,-5,-2,和最大的子段为:11,-4,13。和为20...原创 2018-04-03 16:15:12 · 144 阅读 · 0 评论 -
编辑距离 (dp)
编辑距离 编辑距离,又称Levenshtein距离(也叫做Edit Distance),是指两个字串之间,由一个转成另一个所需的最少编辑操作次数。许可的编辑操作包括将一个字符替换成另一个字符,插入一个字符,删除一个字符。 例如将kitten一字转成sitting: sitten (k->s) sittin (e->i) sitting (->g) 所以kitten和sittin...原创 2018-03-27 22:57:02 · 748 阅读 · 0 评论 -
Knapsack problem FZU - 2214 (01背包变形)
Knapsack problem FZU - 2214 Given a set of n items, each with a weight w[i] and a value v[i], determine a way to choose the items into a...原创 2018-04-15 15:17:17 · 284 阅读 · 0 评论 -
最长公共子序列Lcs
最长公共子序列Lcs 给出两个字符串A B,求A与B的最长公共子序列(子序列不要求是连续的)。 比如两个串为: abcicba abdkscab ab是两个串的子序列,abc也是,abca也是,其中abca是这两个字符串最长的子序列。 Input 第1行:字符串A第2行:字符...原创 2018-03-27 16:29:18 · 223 阅读 · 0 评论 -
背包问题
背包问题 在N件物品取出若干件放在容量为W的背包里,每件物品的体积为W1,W2……Wn(Wi为整数),与之相对应的价值为P1,P2……Pn(Pi为整数)。求背包能够容纳的最大价值。 Input 第1行,2个整数,N和W中间用空格隔开。N...原创 2018-03-27 16:28:12 · 513 阅读 · 0 评论 -
A Spy in the Metro UVA - 1025(dp)
A Spy in the Metro UVA - 1025题意:一个间谍要从第一个车站到第n个车站去会见另一个,在是期间有n个车站,有来回的车站,让你在时间T内时到达n,并且等车时间最短...原创 2018-04-08 17:04:22 · 289 阅读 · 0 评论 -
Schrödinger's Knapsack ZOJ - 4019(dp)
Schrödinger's Knapsack ZOJ - 4019题目链接题意:有一个背包容量为c,有两种物品,第一种物品每个价值都是k1,第二种都是k2,给出n个第一种物品的重量,给出...原创 2018-04-08 15:57:23 · 452 阅读 · 0 评论 -
Balance CodeForces - 17C
Balance CodeForces - 17C Nick likes strings very much, he likes to rotate them, sort them, rearrange characters within a string... Once...原创 2018-02-16 16:02:38 · 258 阅读 · 0 评论