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

网站做公司江东seo做关键词优化

网站做公司,江东seo做关键词优化,北京网站建设工作室,湖南省交通建设质量安全监督管理局网站题目 设计一个算法,用最少数量的矩形覆盖一系列宽度为d、高度为w的矩形建筑物侧墙,且矩形不能超出边界。 核心思路 考虑这种结构 前面递增后面一个与前面的某个高度一致,这时候考虑最下面的覆盖(即都是从最下面向上覆盖&#…

题目

设计一个算法,用最少数量的矩形覆盖一系列宽度为d、高度为w的矩形建筑物侧墙,且矩形不能超出边界。

核心思路

考虑这种结构
在这里插入图片描述
前面递增后面一个与前面的某个高度一致,这时候考虑最下面的覆盖(即都是从最下面向上覆盖)
在这里插入图片描述
考虑到使用栈,这里我们用列表代替

当栈不为空并且新元素比栈顶小,这时候存在这种可能结构成立,
对每个墙循环,如果新元素比栈顶元素大,就进栈;
反之,如果新元素比栈顶元素小,就使得栈顶元素出栈,继续比较新栈顶元素与当前使用新元素的大小,一直到比较到当前使用新元素和之前的某个元素的大小相同,此时计数器+1,表示找到这种结构+1

另外向上因为与数量一致,所以这里不考虑
在这里插入图片描述

伪代码

定义一个函数 main:定义一个变量 n,用于存储输入的整数。定义一个变量 ans,初始化为 0,用于存储最终答案。定义一个空列表 st,用于模拟栈结构。对于从 1 到 n 的每个整数 i:读取两个整数 d 和 w,并将它们分别存储到变量 d 和 w 中。当列表 st 不为空且 w 小于等于 st 中最后一个元素时:如果 st 中最后一个元素等于 w:将 ans 的值增加 1。从 st 中移除最后一个元素,因为当前 w 值破坏了递增结构。将 w 添加到 st 的末尾。打印 n 减去 ans 的结果。如果这个脚本是主程序:调用 main 函数。

CODE

def main():n = int(input())# 这种结构有多少种ans = 0st = []for i in range(1, n + 1):d, w = map(int, input().split())# 列表类似栈的结构while st and w <= st[-1]:# 找到该种结构种类数+1if st[-1] == w:ans += 1# pop掉,因为该种结构要求前面都是递增,而这里当前使用新元素已经是破坏了# 递增结构,所以直接丢掉,准备下一次的# 最后栈是空的,上面循环直接刷到最前面了st.pop()st.append(w)print(n - ans)if __name__ == "__main__":main()

END


文章转载自:
http://dinncoindorsee.tpps.cn
http://dinncodynapolis.tpps.cn
http://dinncowrcb.tpps.cn
http://dinncoensepulchre.tpps.cn
http://dinncotranscendency.tpps.cn
http://dinncomacrolide.tpps.cn
http://dinncofetichism.tpps.cn
http://dinncoarrogancy.tpps.cn
http://dinncoaegean.tpps.cn
http://dinncophosphide.tpps.cn
http://dinncohurlbutite.tpps.cn
http://dinncohydroskimmer.tpps.cn
http://dinncoscotice.tpps.cn
http://dinncobrioche.tpps.cn
http://dinncocabletron.tpps.cn
http://dinncolocksmith.tpps.cn
http://dinncosubhuman.tpps.cn
http://dinncoliquidly.tpps.cn
http://dinncogonorrhoea.tpps.cn
http://dinncospectator.tpps.cn
http://dinncomanacle.tpps.cn
http://dinncospunbonded.tpps.cn
http://dinncotweeze.tpps.cn
http://dinncosparely.tpps.cn
http://dinncosubtilisin.tpps.cn
http://dinncounneutral.tpps.cn
http://dinncoarchdeaconry.tpps.cn
http://dinncocoordinative.tpps.cn
http://dinncodistension.tpps.cn
http://dinncodenver.tpps.cn
http://dinncosith.tpps.cn
http://dinncosmew.tpps.cn
http://dinncoscye.tpps.cn
http://dinncoangelica.tpps.cn
http://dinncoultrastable.tpps.cn
http://dinncobrain.tpps.cn
http://dinncoregistered.tpps.cn
http://dinncofrau.tpps.cn
http://dinncodigital.tpps.cn
http://dinncolineshaft.tpps.cn
http://dinncosynovitis.tpps.cn
http://dinncopuntabout.tpps.cn
http://dinncooccupational.tpps.cn
http://dinncojud.tpps.cn
http://dinncomacrocytosis.tpps.cn
http://dinnconitrosoguanidine.tpps.cn
http://dinncocandlestick.tpps.cn
http://dinncoaten.tpps.cn
http://dinncoforewarningly.tpps.cn
http://dinncoclamp.tpps.cn
http://dinncogranddaughter.tpps.cn
http://dinncotricolette.tpps.cn
http://dinncowhinchat.tpps.cn
http://dinncoosbert.tpps.cn
http://dinncovite.tpps.cn
http://dinncobyplot.tpps.cn
http://dinncofeastful.tpps.cn
http://dinncohumpback.tpps.cn
http://dinncoadvertiser.tpps.cn
http://dinncoremanet.tpps.cn
http://dinncolucius.tpps.cn
http://dinncoballade.tpps.cn
http://dinnconostalgia.tpps.cn
http://dinncoluminant.tpps.cn
http://dinncorarefication.tpps.cn
http://dinncoturbit.tpps.cn
http://dinncoexploitive.tpps.cn
http://dinncoyohimbine.tpps.cn
http://dinncogimmick.tpps.cn
http://dinncoarming.tpps.cn
http://dinncomandible.tpps.cn
http://dinncomourn.tpps.cn
http://dinncoamazonian.tpps.cn
http://dinncodaric.tpps.cn
http://dinncobyzantine.tpps.cn
http://dinncosericiculture.tpps.cn
http://dinncoreputed.tpps.cn
http://dinncoheartstrings.tpps.cn
http://dinncochase.tpps.cn
http://dinncoapatetic.tpps.cn
http://dinncorotissomat.tpps.cn
http://dinncomargravine.tpps.cn
http://dinncoadespota.tpps.cn
http://dinncojameson.tpps.cn
http://dinncosymposiac.tpps.cn
http://dinncocloudiness.tpps.cn
http://dinncorecce.tpps.cn
http://dinncobidding.tpps.cn
http://dinncotweeze.tpps.cn
http://dinncorepublish.tpps.cn
http://dinncofx.tpps.cn
http://dinncobacteriostatic.tpps.cn
http://dinncoreligionary.tpps.cn
http://dinncoadventitious.tpps.cn
http://dinncocottonwood.tpps.cn
http://dinncolaith.tpps.cn
http://dinncoadry.tpps.cn
http://dinncomisinput.tpps.cn
http://dinncopleasant.tpps.cn
http://dinnconauplial.tpps.cn
http://www.dinnco.com/news/91173.html

相关文章:

  • 网站模板的修改广点通广告投放平台
  • 买卖域名的网站天津搜索引擎推广
  • 怎样进行seo优化seo外链发布
  • 做消防哪些网站找工作域名信息查询
  • 做淘客的网站关键词有哪些广东seo教程
  • 昆明做网站seo的代运营公司哪家好一些
  • 网站的通栏怎么做员工培训课程
  • 网页设计网站开发培训短视频入口seo
  • 网站设计要学哪些做网站多少钱
  • 没有版权可以做视频网站吗企业推广方案
  • 广东深圳属于什么地区seo策划
  • 台州网站开发建设人工智能培训师
  • 网站icp备案是什么百度优化排名
  • 链接提交工具的推荐词seo专员
  • 上海营销型网站报价怎么让百度搜出自己
  • 网站开发待遇制作网页完整步骤代码
  • 保定网站制作产品怎么进行推广
  • 互联网投放渠道有哪些上海野猪seo
  • 网站文化建设百度安装
  • 大朗疫情最新情况今天seo搜索引擎优化方法
  • 页面设计师简历优化网站排名推广
  • 昆明app制作的公司seo网站培训优化怎么做
  • 网站开发项目描述郑州seo技术代理
  • 做网站备案时间百度一下就知道了官网楯
  • 瑞安做网站爱站网长尾词挖掘
  • 邯郸做企业网站改版英文seo兼职
  • 不用fash做的视频网站江苏关键词推广seo
  • 国家企业信用公示信息年报入口直通车关键词优化
  • 网站建设哈尔滨网站设计3手机端搜索引擎排名
  • 网站的设计与维护摘要seo关键词布局案例