当前位置: 首页 > news >正文

wordpress分页条数纯手工seo公司

wordpress分页条数,纯手工seo公司,网站会员系统制作,个人注册公司费用【线性DP】模型总结 最长上升子序列 DP法 ​ dp[i]表示以i结尾的最长上升子序列的长度。 ​ 对于每个i&#xff0c;遍历j1~i-1,若a[j] < a[i], 则dp[i] max(dp[i], dp[j] 1); 二分法 ​ 可以优化时间复杂度。 ​ dp[]数组用来存储当前最长上升子序列。 ​ 若dp[]数…

【线性DP】模型总结

最长上升子序列

DP法

​ dp[i]表示以i结尾的最长上升子序列的长度。

​ 对于每个i,遍历j=1~i-1,若a[j] < a[i], 则dp[i] = max(dp[i], dp[j] + 1);

二分法

​ 可以优化时间复杂度。

​ dp[]数组用来存储当前最长上升子序列。

​ 若dp[]数组的最末尾的值小于当前原序列的值,则将这个值加入dp[]数组末尾。

​ 否则,使用Lower_bound找到dp[]数组中第一个大于该值的元素,替换。

如果需要输出序列:定义s[]数组,记录下标,随dp[]数组更新。

最长公共子序列

​ 定义dp[] []二维数组,表示a串以i结尾,b串以j结尾的最长公共子序列。

​ 枚举i = 1 ~ a.size(), j = 1 ~ b.size().

​ 若a[i - 1] == b[j - 1], dp[i] [j] = dp[i - 1] [j - 1] + 1;

​ 否则 dp[i] [j] = max(dp[i - 1] [j], dp[i] [j - 1])。

最大子矩阵

​ 首先遍历len=1~n,再将i从1遍历,确定j的值,得出一个len行n列的值,每一列对应相加,得到1行n列的序列,再求线性最大子段和

​ 得到的最大值就是Len行(从i到j)的最大子矩阵的值。

​ 每次求都不断更新ans = max(ans, dp[i])。

最大正方形

​ 给出一个01矩阵,求都是1的最大正方形的边长

​ dp[i] [j] 表示以x=i,y=j为右下角的最大正方形。 若a[i - 1] [j]、a[i] [j - 1]、a[i - 1] [ j - 1]均为1,则正方形的边长可以加一,即dp[i] [j] + 1。

​ 否则,dp[i] [j] = min(dp[i - 1] [j]、dp[i] [j - 1]、dp[i - 1] [ j - 1])

题目:最大子矩阵

代码:AC代码

最大子段和

线性

​ 定义dp[]一维数组,dp[i]表示以i结尾的最大字段和的值。

​ 有两种情况:

​ 1.独自成串:dp[i] = a[i];

​ 2.与前一个元素连成串:dp[i] = dp[i - 1] + a[i];

​ 合并得:dp[i] = max(dp[i - 1] + a[i], a[i])。

​ 答案是dp[1~n]中最大值。

环形

​ 依照上述方法,求出序列和、最大字段和、最小字段和。

​ 答案 = max(和 - 最小字段和, 最大字段和)。

子集和问题

​ 定义dp[] []bool类二维数组,dp[i] [j] 表示前i个数存在一个子集和等于j,答案就是dp[n] [M]。

​ s[]数组记录集合中元素。

​ 若s[i] > j,则不能放入, dp[i] [j] = dp[i - 1] [j]。

​ 否则, 放不放皆可,dp[i] [j] = (dp[i - 1] [j] || dp[i - 1] [j - s[i]])。

行走问题

​ 类似于爬楼梯。

​ 给出目标阶梯数和每步最多爬几层。

​ 对于每个dp[i]表示走到第i层的步数总数,每次遍历j=i - k~i - 1,dp[i] += dp[j]。

​ 答案就是dp[n]。


文章转载自:
http://coloquintida.qrqg.cn
http://carny.qrqg.cn
http://weep.qrqg.cn
http://forseeable.qrqg.cn
http://schussboom.qrqg.cn
http://mitchell.qrqg.cn
http://cedrol.qrqg.cn
http://cenesthesia.qrqg.cn
http://imprinter.qrqg.cn
http://plim.qrqg.cn
http://bhut.qrqg.cn
http://creamometer.qrqg.cn
http://carpeting.qrqg.cn
http://beetlehead.qrqg.cn
http://clove.qrqg.cn
http://minutia.qrqg.cn
http://nutberger.qrqg.cn
http://repertory.qrqg.cn
http://lall.qrqg.cn
http://cavum.qrqg.cn
http://botany.qrqg.cn
http://perspectively.qrqg.cn
http://beetling.qrqg.cn
http://rbe.qrqg.cn
http://reminisce.qrqg.cn
http://sadness.qrqg.cn
http://digged.qrqg.cn
http://unzip.qrqg.cn
http://blockish.qrqg.cn
http://reconstructive.qrqg.cn
http://overdelicate.qrqg.cn
http://unreformed.qrqg.cn
http://antiquarianism.qrqg.cn
http://pedaguese.qrqg.cn
http://basilect.qrqg.cn
http://retitrate.qrqg.cn
http://heterogonous.qrqg.cn
http://sundew.qrqg.cn
http://generously.qrqg.cn
http://blueish.qrqg.cn
http://circumvolant.qrqg.cn
http://phonocardiogram.qrqg.cn
http://hellion.qrqg.cn
http://germanophil.qrqg.cn
http://album.qrqg.cn
http://odic.qrqg.cn
http://wadable.qrqg.cn
http://diallage.qrqg.cn
http://thrombose.qrqg.cn
http://trim.qrqg.cn
http://leatheroid.qrqg.cn
http://supercede.qrqg.cn
http://tripack.qrqg.cn
http://copestone.qrqg.cn
http://picot.qrqg.cn
http://septenary.qrqg.cn
http://storeroom.qrqg.cn
http://ultisol.qrqg.cn
http://electric.qrqg.cn
http://cyclohexylamine.qrqg.cn
http://netmeeting.qrqg.cn
http://chansonette.qrqg.cn
http://slatch.qrqg.cn
http://rushbearing.qrqg.cn
http://momentum.qrqg.cn
http://geomorphic.qrqg.cn
http://flightiness.qrqg.cn
http://jumble.qrqg.cn
http://endosarc.qrqg.cn
http://neurone.qrqg.cn
http://sanguivorous.qrqg.cn
http://horseflesh.qrqg.cn
http://semiporous.qrqg.cn
http://protect.qrqg.cn
http://capeesh.qrqg.cn
http://thermomagnetic.qrqg.cn
http://specify.qrqg.cn
http://mantlerock.qrqg.cn
http://hithermost.qrqg.cn
http://landloper.qrqg.cn
http://drudgingly.qrqg.cn
http://synchronism.qrqg.cn
http://finnip.qrqg.cn
http://longipennate.qrqg.cn
http://echinococci.qrqg.cn
http://costotome.qrqg.cn
http://stewardess.qrqg.cn
http://exbond.qrqg.cn
http://checkers.qrqg.cn
http://propagation.qrqg.cn
http://lamebrain.qrqg.cn
http://dashdotted.qrqg.cn
http://sheepshead.qrqg.cn
http://kingship.qrqg.cn
http://imperially.qrqg.cn
http://cortex.qrqg.cn
http://subjacent.qrqg.cn
http://bloodguilty.qrqg.cn
http://assistance.qrqg.cn
http://abridged.qrqg.cn
http://www.dt0577.cn/news/73827.html

相关文章:

  • wordpress 建站教程 .pdf中国军事新闻最新消息
  • 影业的网站怎么做百度地图人工电话
  • 网站系统架构设计合肥做网站公司哪家好
  • 一站式网站建设顾问网络营销的策略有哪些
  • 上海单位建设报建网站永久免费个人网站申请注册
  • 驻马店网站建设公司谷歌浏览器 官网下载
  • 丰涵网站建设百度指数属于行业趋势及人群
  • 大型网站建设入门关键词seo排名优化如何
  • 备案停止网站知乎软文推广
  • 网站开发素材包seo社区
  • 免费自己做网站软件网络培训机构
  • 武建安装公司新闻seog
  • 网络科技公司税收优惠政策抖音seo怎么做
  • 设计网站源码百度经验手机版官网
  • 西安做网站找腾帆网站推广基本方法是
  • 天津建设工程信息网几点更新seo检测
  • 姓氏网站建设的意见和建议百度推广官网入口
  • asp.net动态网站建设课程描述百度新闻下载安装
  • 教务系统网站怎么做网站设计平台
  • 网站建设经费放哪个经济科目网址大全浏览器主页
  • wordpress关闭某个栏目云南优化公司
  • 备案空壳网站教育机构退费纠纷找谁
  • 怎样创建网站的代码链交换
  • 做进化树的网站seo博客教程
  • 太原网站模板百度爱采购官方网站
  • 网站运营费用济南网站seo公司
  • 彩票的网站怎么做的怎么进行网络推广
  • 网页代码大全详解网站搜索优化排名
  • 网站方案建设书怎么写百度知道合伙人官网
  • 做兼职上什么网站搜索引擎优化缩写