动态规划
文章平均质量分 81
xieshimao
topcoder
展开
-
Leetcode 1223. 掷骰子模拟【动态规划】
leetcode 1223. 掷骰子模拟,动态规划算法原创 2023-02-15 17:56:17 · 608 阅读 · 0 评论 -
LeetCode 834.树中距离之和 Sum of distance in tree
LeetCode 834.树中距离之和 Sum of distance in tree给定一个无向、连通的树。树中有 N 个标记为 0...N-1 的节点以及 N-1 条边 。第 i 条边连接节点 edges[i][0] 和 edges[i][1] 。返回一个表示节点 i 与其他所有节点距离之和的列表 ans。示例 1:输入: N = 6, edges = [[0,1],[0,2...原创 2018-10-09 11:02:51 · 1341 阅读 · 1 评论 -
leetcode 714. 买卖股票的最佳时机含手续费 best-time-to-buy-and-sell-stock-with-transaction-fee
给定一个整数数组 prices,其中第 i 个元素代表了第 i 天的股票价格 ;非负整数 fee 代表了交易股票的手续费用。你可以无限次地完成交易,但是你每次交易都需要付手续费。如果你已经购买了一个股票,在卖出它之前你就不能再继续购买股票了。返回获得利润的最大值。示例 1:输入: prices = [1, 3, 2, 8, 4, 9], fee = 2输出: 8解释: 能够达...原创 2018-09-26 15:24:28 · 672 阅读 · 0 评论 -
lintcode 1259. Integer Replacement 搜索
描述Given a positive integer n and you can do operations as follow:1.If n is even, replace n with n/2.2.If n is odd, you can replace n with either n + 1 or n - 1.What is the minimum number of rep...原创 2018-09-13 14:31:04 · 242 阅读 · 0 评论 -
Codeforces Round #178 (Div. 2) B Shaass and Bookshelf
B. Shaass and Bookshelftime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputShaass has n books. He wants to mak原创 2013-04-08 02:51:07 · 3103 阅读 · 0 评论 -
POJ 3186 动态规划
题目链接:http://poj.org/problem?id=3186题意:给定n个数每次可以从头或者尾取出数据于是按取出来得顺序,就可以排成一个数列,假设这个数列为a1,a2,a3,a4.......an现在我们假设按照取出来的顺序有一个权值w=a1*1+a2*2+a3*3+....an*n现在需要编程求出,如何控制取数的顺序,让w的值最大 思路:首先我以原创 2011-03-31 14:11:00 · 2675 阅读 · 0 评论 -
HDU/HDOJ 1171 Big Event in HDU 01背包、多重背包、母函数
Big Event in HDUTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8342 Accepte原创 2011-08-07 20:21:49 · 2395 阅读 · 1 评论 -
HDU/HDOJ 2067 小兔的棋盘
小兔的棋盘Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2443 Accepted Submission原创 2011-09-04 17:13:31 · 3871 阅读 · 2 评论 -
POJ 2955 DP动态规划
BracketsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 1659 Accepted: 831DescriptionWe give原创 2011-02-06 23:45:00 · 1566 阅读 · 1 评论 -
POJ 1080 动态规划(LCS变种)
Human Gene FunctionsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 10904 Accepted: 6015<br />DescriptionIt is well known that a human gene can be considered as a sequence, consisting of four nucleotides, which are simply denoted by four letters,原创 2011-03-23 10:28:00 · 1203 阅读 · 0 评论 -
TOJ 比赛C题 Visiting Cows (TJU 2011 Exercise Contest 04)
C. Visiting CowsTime Limit: 1.0 Seconds Memory Limit: 65536K<br />Total Runs: 61 Accepted Runs: 21 Multiple test files<br /><br /><br />Description<br />After many weeks of hard work, Bessie is finally getting a vacation! Being the most social cow原创 2011-01-30 16:48:00 · 1057 阅读 · 0 评论