ICPC-动态规划DP
文章平均质量分 85
ICPC程序设计中,有关动态规划的题解
海岛Blog
专注于程序设计及其竞赛,专注于集成电路EDA设计
展开
-
UVA10759 Dice Throwing【概率+DP】
n common cubic dice are thrown. What is the probability that the sum of all thrown dice is at least x?InputThe input file contains several test cases. Each test case consists two integers n (1 ≤ n ≤ 24) and x (0 ≤ x < 150). The meanings of n and x are原创 2022-05-08 09:48:50 · 530 阅读 · 0 评论 -
UVA10328 Coin Toss【DP+大数】
Toss is an important part of any event. When everything becomes equal toss is the ultimate decider. Normally a fair coin is used for Toss. A coin has two sides head(H) and tail(T). Superstition may work in case of choosing head or tail. If anyone becomes w原创 2022-04-29 01:09:47 · 362 阅读 · 0 评论 -
POJ3280 Cheapest Palindrome【回文+DP】
Cheapest PalindromeTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 17753 Accepted: 8257DescriptionKeeping track of all the cows can be a tricky task so Farmer John has installed a system to automate it. He has installed on each cow an elect原创 2021-08-10 23:34:19 · 277 阅读 · 0 评论 -
POJ2609 Ferry Loading【DP】
Ferry LoadingTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 1970 Accepted: 549 Special JudgeDescriptionBefore bridges were common, ferries were used to transport cars across rivers. River ferries, unlike their larger cousins, run on a gui原创 2021-08-02 19:04:13 · 265 阅读 · 0 评论 -
UVA10261 Ferry Loading【DP】
Before bridges were common, ferries were used to transport cars across rivers. River ferries, unlike their larger cousins, run on a guide line and are powered by the river’s current. Two lanes of cars drive onto the ferry from one end, the ferry crosses th原创 2021-08-02 18:49:00 · 531 阅读 · 0 评论 -
UVA116 HDU1619 Unidirectional TSP【DP】
Unidirectional TSPTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1682 Accepted Submission(s): 803Problem DescriptionProblems that require minimum paths through some domain appear in many diffe原创 2021-08-02 10:14:04 · 202 阅读 · 0 评论 -
POJ2704 HDU1208 LA3390 Pascal‘s Travels【递推+记忆化搜索】
Pascal’s TravelsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 5656 Accepted: 2538DescriptionAn n x n game board is populated with integers, one nonnegative integer per square. The goal is to travel along any legitimate path from the upper原创 2021-08-01 19:55:36 · 345 阅读 · 0 评论 -
UVA11258 String Partition【DP】
John was absurdly busy for preparing a programming contest recently. He wanted to create a ridiculously easy problem for the contest. His problem was not only easy, but also boring: Given a list of non-negative integers, what is the sum of them? &nbs原创 2021-06-24 07:42:46 · 196 阅读 · 0 评论 -
UVA10912 Simple Minded Hashing【DP】
All of you know a bit or two about hashing. It involves mapping an element into a numerical value using some mathematical function. In this problem we will consider a very ‘simple minded hashing’. It involves assigning numerical value to the alphabets and原创 2021-06-24 07:23:43 · 221 阅读 · 0 评论 -
UVA11151 Longest Palindrome【最长回文】
A palindrome is a string that reads the same from the left as it does from the right. For example, I, GAG and MADAM are palindromes, but ADAM is not. Here, we consider also the empty string as a palindrome. From any non-palindromic原创 2021-06-24 05:59:35 · 335 阅读 · 0 评论 -
UVA10003 Cutting Sticks【DP】
You have to cut a wood stick into pieces. The most affordable company, The Analog Cutting Machinery, Inc. (ACM), charges money according to the length of the stick being cut. Their procedure of work requires that they only make one cut at a time. &nb原创 2021-06-22 12:50:52 · 198 阅读 · 0 评论 -
UVA10081 POJ2537 ZOJ1883 Tight Words【DP】
Tight wordsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2845 Accepted: 1332DescriptionGiven is an alphabet {0, 1, … , k}, 0 <= k <= 9 . We say that a word of length n over this alphabet is tight if any two neighbour digits in the w原创 2021-06-20 18:21:30 · 205 阅读 · 0 评论 -
UVA10617 Again Palindrome【DP】
A palindorme is a sequence of one or more characters that reads the same from the left as it does from the right. For example, Z, TOT and MADAM are palindromes, but ADAM is not. Given a sequence S of N capital latin letters. How man原创 2021-06-19 19:26:29 · 193 阅读 · 0 评论 -
UVA10934 Dropping water balloons【DP】
It’s frosh week, and this year your friends have decided that they would initiate the new computer science students by dropping water balloons on them. They’ve filled up a large crate of identical water balloons, ready for the event. But as fate would have原创 2021-06-19 04:50:10 · 258 阅读 · 0 评论 -
POJ2096 Collecting Bugs【概率DP】
Collecting BugsTime Limit: 10000MS Memory Limit: 64000KTotal Submissions: 11811 Accepted: 5337Case Time Limit: 2000MS Special JudgeDescriptionIvan is fond of collecting. Unlike other people who collect post stamps, coins or other material stuff, he原创 2021-04-21 22:01:00 · 260 阅读 · 0 评论 -
HDU4489 The King‘s Ups and Downs【DP】
The King’s Ups and DownsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1617 Accepted Submission(s): 1110Problem DescriptionThe king has guards of all different heights. Rather than line them u原创 2021-04-13 19:15:57 · 223 阅读 · 0 评论 -
HDU2182 Frog【DP】
FrogTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2529 Accepted Submission(s): 1126Problem DescriptionA little frog named Fog is on his way home. The path’s length is N (1 <= N <= 100),原创 2021-04-13 18:45:13 · 262 阅读 · 0 评论 -
POJ3671 Dining Cows【DP】
Dining CowsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 9308 Accepted: 3809DescriptionThe cows are so very silly about their dinner partners. They have organized themselves into two groups (conveniently numbered 1 and 2) that insist upon原创 2021-02-20 08:50:04 · 252 阅读 · 0 评论 -
Bailian4145 放弃考试 POJ2976 ZOJ3068 Dropping tests【二分法+01分数规划】
4145:放弃考试总时间限制: 1000ms 内存限制: 65536kB描述在一门课程中,一共有n场考试。假如你在i场考试中可以答对bi道题中的ai道,那么你的累计平均分定义为:100·Σai/Σbi。已知你这i场考试的答题情况,并且允许你放弃其中的k场考试,请你确定你最高能够得到多少的累计平均分。假设该课程一共有3门考试,你的答题情况为5/5,0/1和2/6。如果你每门都参加,你的累计平均分为100·(5+0+2)/(5+1+6)= 50分。如果你放弃第3场考试,你的累计平均分则提高到了100·(原创 2020-06-07 06:43:46 · 1676 阅读 · 0 评论 -
HDU1260 Tickets【DP】
TicketsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 14552 Accepted Submission(s): 7216Problem DescriptionJesus, what a great movie! Thousands of people are rushing to the cinema. However, th原创 2020-05-17 00:10:26 · 542 阅读 · 0 评论 -
HDU2571 命运【动态规划DP】
命运Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 27549 Accepted Submission(s): 9535Problem Description穿过幽谷意味着离大魔王lemon已经无限接近了!可谁能想到,yif...原创 2020-04-30 21:35:44 · 355 阅读 · 0 评论 -
HDU1506 POJ2559 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): 31315 Accepted Submission(s): 10156Problem DescriptionA h...原创 2020-04-10 20:07:22 · 320 阅读 · 0 评论 -
UVA10721 Bar Codes【动态规划DP】
A bar-code symbol consists of alternating dark and light bars, starting with a dark bar on the left. Each bar is a number of units wide. Figure 1 shows a bar-code symbol consisting of 4 bars that exte...原创 2020-04-06 11:00:51 · 380 阅读 · 0 评论 -
ZOJ3872 Beauty of Array【DP】
Beauty of ArrayTime Limit: 2 Seconds Memory Limit: 65536 KBEdward has an array A with N integers. He defines the beauty of an array as the summation of all distinct integers in the arra原创 2017-07-04 00:07:23 · 888 阅读 · 0 评论 -
NUC1041 数字三角形【DP】
USACO Gateway数字三角形时间限制: 1000ms 内存限制: 32768KB问题描述佳佳遇到一个麻烦的问题,如下图所示,一个数字三角形,佳佳想找出从三角形顶点到底某处的一条路径,使的该路径所经过的数字总和最大.(1).每一步可沿左斜线向下或右斜线向下.(2).1L)图中沿所画的线路可得到最大的值,但是佳佳遇到很多数字三角形,请你帮她写原创 2017-05-07 07:23:37 · 811 阅读 · 0 评论 -
NUC1131 Triangle【DP】
Triangle时间限制: 1000ms 内存限制: 65536KB通过次数: 1总提交次数: 1问题描述图1表示一个数字三角形。73 88 1 02 7 4 44 5 2 6 5(图1)编写一个程序可以按照一种路线求得所划数字的最大和。这种路线可以从顶端开始也可以从底部开始,每一步即可延对角线向左也可以延对原创 2017-06-27 05:54:01 · 492 阅读 · 0 评论 -
NUC1776 Tiling Up Blocks【二维最长上升子序列+DP】
Tiling Up Blocks时间限制: 1000ms 内存限制: 10000KB通过次数: 2总提交次数: 2问题描述Michael The Kid receives an interesting game set from his grandparent as his birthday gift. Inside the game set box, there are原创 2017-06-27 06:27:28 · 1015 阅读 · 0 评论 -
ZOJ2136 Longest Ordered Subsequence【DP】
Longest Ordered SubsequenceTime Limit: 2 Seconds Memory Limit: 65536 KBA numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence of the given numeric sequence (a1,原创 2017-12-20 10:19:45 · 753 阅读 · 0 评论 -
NUC1157 To the Max【最大子段和+DP】
To the Max时间限制: 1000ms 内存限制: 65536KB通过次数: 1总提交次数: 1问题描述Given a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1*1 or greater原创 2017-06-26 08:03:48 · 660 阅读 · 0 评论 -
UVA10910 Marks Distribution【组合+DP】
In an examination one student appeared in N subjects and has got total T marks. He has passed inall the N subjects where minimum mark for passing in each subject is P. You have to calculate thenumber原创 2018-02-06 06:39:22 · 507 阅读 · 0 评论 -
HDU2084 数塔【DP】
数塔Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 51530 Accepted Submission(s): 30346Problem Description在讲述DP算法的时候,一个经典的例子就是数塔问题,它是这样描述的:有如下所...原创 2018-02-24 09:27:23 · 877 阅读 · 0 评论 -
POJ2193 ZOJ2193 UVALive3144 Lenny's Lucky Lotto Lists【DP】
Lenny's Lucky Lotto ListsTime Limit: 1000MS Memory Limit: 65536K Total Submissions: 2191 Accepted: 953 DescriptionLenny likes to play the game of lotto. In the lotto game, he p...原创 2018-08-23 22:58:32 · 594 阅读 · 0 评论 -
POJ1163 The Triangle【DP】
The TriangleTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 58810 Accepted: 35304Description73 88 1 02 7 4 44 5 2 6 5(Figure 1)Figure 1 shows a number triangl...原创 2019-01-09 16:39:02 · 466 阅读 · 0 评论 -
HDU1559 最大子矩阵【DP】
最大子矩阵Time Limit: 30000/10000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5010 Accepted Submission(s): 2620Problem Description给你一个m×n的整数矩阵,在上面找一个x×y原创 2017-06-17 18:21:03 · 899 阅读 · 0 评论