
动态规划
文章平均质量分 75
aaron_1996
let the next come now!
展开
-
递推关系之划分空间问题(hdu 1290&&2050)
其实在写这篇文章之前,感觉上与现在的计算机技术并没有什么联系。但是,线段与平面划分空间的问题是代数结构,特别是递推关系中一类十分重要的题目。所以在这里特写一篇文章,对这一类的问题进行分析。我们知道,平面是二维的,而空间是三维的,这一类划分空间的问题是具有很多共性的。首先,我们来思考两条直线划分平面的问题。一条直线可以将平面划分为两个部分,两条直线最多可以将平面划分为4个部分,当有n条直线呢?原创 2015-05-19 23:17:42 · 730 阅读 · 0 评论 -
[hdu5492]背包问题的扩展
Frog fell into a maze. This maze is a rectangle containing N rows and M columns. Each grid in this maze contains a number, which is called the magic value. Frog now stays at grid (1, 1)原创 2016-08-17 16:29:33 · 368 阅读 · 0 评论 -
hdu4901-DP注意精度
There is an old country and the king fell in love with a devil. The devil always asks the king to do some crazy things. Although the king used to be wise and beloved by his people.原创 2016-08-06 14:57:09 · 274 阅读 · 0 评论 -
POJ1644 DP+一些感悟
DP和个人的一些感悟原创 2016-08-03 11:19:47 · 357 阅读 · 0 评论 -
POJ3920状态压缩和组合数学
Acmers have been the Earth Protector against the evil enemy for a long time, now it’s your turn to protect our home.原创 2016-08-07 16:48:21 · 368 阅读 · 0 评论 -
POJ2151正难则反
Organizing a programming contest is not an easy job. To avoid making the problems too difficult, the organizer usually expect the contest result satisfy the following two terms:原创 2016-08-09 13:22:24 · 324 阅读 · 0 评论 -
hdu5045状态压缩DP
In the ACM International Collegiate Programming Contest, each team consist of three students. And the teams are given 5 hours to solve between 8 and 12 programming problems.原创 2016-08-14 19:34:54 · 319 阅读 · 0 评论 -
[hdu5898]ACM/ICPC Reginal Shengyang
For a number,if the length of continuous odd digits is even and the length of continuous even digits is odd,we call it odd-even number.Now we want to know the amount of odd-even number.原创 2016-09-18 21:57:05 · 832 阅读 · 4 评论 -
hihocoder1136-DAG和DP的关系
Professor Q develops a new software. The software consists of N modules which are numbered from 1 to N. The i-th module will be started up by signal Si.原创 2016-11-10 09:29:19 · 333 阅读 · 0 评论 -
[hihocoder1063]树形DP
题目描述假设当前作战区域是一棵有根树,编织者所在的位置为根节点1,树中每个节点,有一个权值vi,代表这个节点的收益。树中的每条边,有一个权值wi,代表每条边的长度。编织者从根结点出发,最远累计移动d 距离时,所能得到的收益的最大值是多少?注意重复经过一个节点收益只能计算一次。算法思路我们很显然可以得到一种算法思路是:dp[i][j],表示从第i个结点走j个单位的路程可以得到的最大收益。原创 2016-11-10 23:36:10 · 345 阅读 · 0 评论 -
[hdu4940]Tourism Planning 状态压缩DP
题目描述Several friends are planning to take tourism during the next holiday. They have selected some places to visit. They have decided which place to start their tourism and in which order to visit these原创 2016-11-21 23:23:34 · 404 阅读 · 0 评论 -
hdu2577一道很不错的DP
Pirates have finished developing the typing software. He called Cathy to test his typing software. She is good at thinking. After testing for several days, she finds that if she types a string by s原创 2016-08-05 10:07:05 · 327 阅读 · 0 评论 -
hdu4722数位DP
If we sum up every digit of a number and the result can be exactly divided by 10, we say this number is a good number. You are required to count the number of good numbers in the range from A to B原创 2016-08-05 09:56:49 · 455 阅读 · 0 评论 -
[hdu2089&&hdu3555]数位DP
数位DP个人的感悟原创 2016-08-01 16:06:57 · 267 阅读 · 0 评论 -
模拟除法和取余运算(hdu acm 2114&2117)
最近在杭电的ACM上看到了两道题2116,2117.虽然难度不算太大,却给了我很大的启示。除法与取余运算,这两种本该在一种运算中的工具。具有不同的意义。顾名思义,取余得到的结果,就是被除数除去除数后的结果。这种运算,在处理大数的过程中具有很大的意义。而做模拟整除,就是在不断重复我们小学时代做除法竖式时的情景,即做除法,得到一个结果,再对得到的余数乘上10(或者进制数)再次进行除法。我们惯性的思原创 2015-04-17 07:07:44 · 1760 阅读 · 0 评论 -
POJ 1018 dp问题的一般过程
做dp问题已经有一段时间了。虽然感觉dp算法的思路还不是那么清晰,但是思维和以前比已经有了巨大的进步。在这儿,我想借poj中的一道题,对dp问题进行一个小小的总结。成长的路还有很长很长。Communication SystemDescriptionWe have received an order from Pizoor Communications Inc. for原创 2015-06-04 17:49:48 · 557 阅读 · 1 评论 -
dp问题中的转移思考(hdu 1466)
dp问题是日常生活乃至编程竞赛中经常遇到的一类有意义的问题,他的一大特点就是:记录下小规模数据的最优解,然后将其应用于大规模数据的计算当中。但是,在这儿,最难思考的就是所谓的转移方程。如何通过合适的变化得到当前的状态,是动态规划问题的核心。可以说,得到了相应的状态转移方程,问题便相应而解。下面,就看一道杭电的简单动态规划来看具体的状态转移。题目的网址:http://acm.hdu.edu.cn原创 2015-05-21 23:14:36 · 458 阅读 · 0 评论 -
dp问题最佳路径的构建 poj 1015
我承认,作为一个新手,这道题困扰了我很长时间,各个步骤我觉得都很难。从最优解的刻画到最后最佳方案的构建都花了我很多时间,也听了许多大神的建议。最后终于解决了这道题。Jury CompromiseDescriptionIn Frobnia, a far-away country, the verdicts in court trials are determined by原创 2015-06-06 00:04:57 · 521 阅读 · 0 评论 -
0-1分数规划的Dinkelbach算法
基本模型的概述0-1分数规划问题是经济统计,数据挖掘中一类十分重要的问题.其基本的模型是,我们知道一组产品的投入a[n],也知道一组产品的可以得到的利润,那么,这个时候我们从这n件产品中选择k件,怎么样来选择才能让我们最终的选择利润率最高呢?即我们知道是sigma(b[i])/sigma(a[i])最大模型的分析很显然,我们知道,选择b[i]/a[i]最大的k件物品是无法找到最大的组合原创 2015-09-05 12:53:00 · 1622 阅读 · 0 评论 -
HDU ACM 2100
今天写到了杭电的一道ACM题,困扰了我好久,不过终于AC了,写代码的时候还是感觉那么乱,可能这就是成长的阵痛吧。话不多说,下面是题目的描述这道题,就是经典的进制之间转化的题目,和同期的比赛很像。而字符型变量和整形变量可以相互转化,就带来了我们最后的解法。开始是我想完全将其转化为整数再将其转化回字符串。但后来发现这样难度太大,而且也不够简介。故想到利用整形数组储存每一个位置上原创 2015-04-10 22:08:51 · 1892 阅读 · 2 评论 -
动态规划问题的一般解决方案
动态规划问题的一般解决方案动态规划的历史渊源动态规划问题是由Bellman教授提出的一种用于解决当问题的规模很大时利用转移而将问题分割为子问题的一种算法思想。他也在1979年获得了ACM,IEEE协会颁发的终生成就奖。动态规划问题的一般思路由上面的论述,我们可以知道,动态规划问题是用来解决问题规模很大而大问题可以分割为子问题并且加以解决的一种算法思想, 那么, 我们怎么样解决一个动态规划问题呢?原创 2015-12-14 23:14:01 · 1874 阅读 · 0 评论 -
POJ1143位操作+状态压缩
状态压缩+位操作+动态规划原创 2016-08-03 15:39:43 · 383 阅读 · 0 评论 -
POJ1155[树状DP+启发式优化]
一个树状DP及其优化的方法原创 2016-07-31 17:51:46 · 294 阅读 · 0 评论 -
hdu5000一道很有意思的DP
After eating food from Chernobyl, DRD got a super power: he could clone himself right now! He used this power for several times. He found out that this power was not as perfect as he wanted.原创 2016-08-15 21:49:47 · 643 阅读 · 0 评论 -
hihocoder1104(Dfs预处理+树形DP)
题目描述Little Hi is taking an adventure in Suzhou now. There are N beautiful villages in Suzhou which are numbered from 1 to N. They connected by N-1 roads in such a way that there is excactly one way to原创 2016-11-26 11:07:49 · 437 阅读 · 0 评论