
动态规划
文章平均质量分 54
浅夏淡香
这个作者很懒,什么都没留下…
展开
-
SWUST OJ 之 1139 Coin-row problem
There is a row of n coins whose values are some positive integers c₁, c₂,...,cn, not necessarily distinct. The goal is to pick up the maximum amount of money subject to the constraint that no two coi...原创 2018-06-03 09:53:23 · 2801 阅读 · 0 评论 -
SWUST OJ 之 0577 Shortest path counting
Tags: 动态规划A chess rook can move horizontally o r vertically to any square in the same row o r in the same column of a chessboard. Find the number of shortest paths by which a rook can move from one...原创 2018-07-06 22:05:43 · 563 阅读 · 0 评论 -
SWUST OJ 之 0676 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 behind is simple...原创 2018-07-05 21:27:51 · 359 阅读 · 0 评论 -
SWUST OJ 之 0697 Edit Distance
题目设A 和B 是2 个字符串。要用最少的字符操作将字符串A 转换为字符串B。这里所说的字符操作包括 (1)删除一个字符; (2)插入一个字符; (3)将一个字符改为另一个字符。 将字符串A变换为字符串B 所用的最少字符操作数称为字符串A到B 的编辑距离,记为d(A,B)。试设计一个有效算法,对任给的2 个字符串A和B,计算出它们的编辑距离d(A,B)。输入第一行是字符串A,文件的...原创 2018-07-17 16:46:22 · 2362 阅读 · 2 评论 -
SWUST OJ 之 0594 Maximum Tape Utilization Ratio
题目设有n 个程序{1,2,…, n }要存放在长度为L的磁带上。程序i存放在磁带上的长度是li ,1 < = i < = n。 程序存储问题要求确定这n 个程序在磁带上的一个存储方案,使得能够在磁带上存储尽可能多的程序。在保证存储最多程序的前提下还要求磁带的利用率达到最大。 对于给定的n个程序存放在磁带上的长度,编程计算磁带上最多可以存储的程序数和占用磁带的长度。输入第...原创 2018-07-17 15:48:43 · 1566 阅读 · 0 评论 -
SWUST OJ 之 0676 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 behind is simpl...原创 2018-07-16 16:32:35 · 382 阅读 · 0 评论 -
SWUST OJ 之 0574 Renting Boats
长江游艇俱乐部在长江上设置了n 个游艇出租站1,2,…,n。游客可在这些游艇出租站租用游艇,并在下游的任何一个游艇出租站归还游艇。游艇出租站i 到游艇出租站j 之间的租金为r(i,j),1< =i< j < =n。试设计一个算法,计算出从游艇出租站1 到游艇出租站n 所需的最少租金。输入第1 行中有1 个正整数n(n<=200),表示有n个游艇出租站。接下来的n-...原创 2018-07-16 15:25:21 · 1704 阅读 · 0 评论 -
SWUST OJ 之 0195 Buyer
Tags: 动态规划哆啦A梦班级举办个party,当然吃的东西必不可少,哆啦A梦负责采购任务,他得到了一份清单,上面注明不同食品的受欢迎程度,哆啦A梦需要用一定的价钱尽可能达到的更大的受欢迎程度!例如,瓜子的受欢迎程度为20,瓜子的价钱是50元,那么如果哆啦A梦选择买瓜子,将花费50元,但受欢迎程度增加了20。为了避免食品单调性,每种食品只能买一份,不能重复购买。 现在哆啦A梦需要知道如何采...原创 2018-06-03 12:40:12 · 1655 阅读 · 0 评论 -
SWUST OJ 之 0032 简单背包问题
设有一个背包可以放入的物品重量为S,现有n件物品,重量分别是w1,w2,w3,…wn。 问能否从这n件物品中选择若干件放入背包中,使得放入的重量之和正好为S。 如果有满足条件的选择,则此背包有解,否则此背包问题无解。输入输入数据有多行,包括放入的物品重量为s,物品的件数n,以及每件物品的重量(输入数据均为正整数)多组测试数据。输出对于每个测试实例,若满足条件则输出“...原创 2018-05-29 22:21:49 · 1196 阅读 · 0 评论 -
SWUST OJ 之 1132 Coin-collecting by robot
Several coins are placed in cells of an n×m board. A robot, located in the upper left cell of the board, needs to collect as many of the coins as possible and bring them to the bottom right cell. On ...原创 2018-06-03 11:31:17 · 2627 阅读 · 0 评论 -
SWUST OJ 之 0680 Jack Straws
n the game of Jack Straws, a number of plastic or wooden "straws" are dumped on the table and players try to remove them one-by-one without disturbing the other straws. Here, we are only concerned wi...原创 2018-07-15 21:35:43 · 1571 阅读 · 0 评论