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

洛阳市住房和城乡建设网站校园局域网站建设费用

洛阳市住房和城乡建设网站,校园局域网站建设费用,app推广拉新一手渠道代理,企业网站页脚算法可以发掘本质#xff0c;如#xff1a; 一#xff0c;若干师傅和徒弟互有好感#xff0c;有好感的师徒可以结对学习。师傅和徒弟都只能参加一个对子。如何让对子最多。 二#xff0c;有无限多1X2和2X1的骨牌#xff0c;某个棋盘若干格子坏了#xff0c;如何在没有坏…算法可以发掘本质如 一若干师傅和徒弟互有好感有好感的师徒可以结对学习。师傅和徒弟都只能参加一个对子。如何让对子最多。 二有无限多1X2和2X1的骨牌某个棋盘若干格子坏了如何在没有坏的格子放足够多骨牌。 三某个单色图1表示前前景0表示后景色。每次操作可以将一个1变成0。如何在最少得操作情况下使得没有两个1相邻四连通。 四若干路人有些人是熟人如何选出最多的人参加实验。为了避免熟人影响实验的效果参加的人不能是熟人。 一二是二分图的最大匹配三是二分图的最小点覆盖四是二分图最大独立集。 而这三者是等效问题。 本文涉及知识点 线段树 LeetCode2276. 统计区间中的整数数目 给你区间的 空 集请你设计并实现满足要求的数据结构 新增添加一个区间到这个区间集合中。 统计计算出现在 至少一个 区间中的整数个数。 实现 CountIntervals 类 CountIntervals() 使用区间的空集初始化对象 void add(int left, int right) 添加区间 [left, right] 到区间集合之中。 int count() 返回出现在 至少一个 区间中的整数个数。 注意区间 [left, right] 表示满足 left x right 的所有整数 x 。 示例 1 输入 [“CountIntervals”, “add”, “add”, “count”, “add”, “count”] [[], [2, 3], [7, 10], [], [5, 8], []] 输出 [null, null, null, 6, null, 8] 解释 CountIntervals countIntervals new CountIntervals(); // 用一个区间空集初始化对象 countIntervals.add(2, 3); // 将 [2, 3] 添加到区间集合中 countIntervals.add(7, 10); // 将 [7, 10] 添加到区间集合中 countIntervals.count(); // 返回 6 // 整数 2 和 3 出现在区间 [2, 3] 中 // 整数 7、8、9、10 出现在区间 [7, 10] 中 countIntervals.add(5, 8); // 将 [5, 8] 添加到区间集合中 countIntervals.count(); // 返回 8 // 整数 2 和 3 出现在区间 [2, 3] 中 // 整数 5 和 6 出现在区间 [5, 8] 中 // 整数 7 和 8 出现在区间 [5, 8] 和区间 [7, 10] 中 // 整数 9 和 10 出现在区间 [7, 10] 中 提示 1 left right 109 最多调用 add 和 count 方法 总计 105 次 调用 count 方法至少一次 线段树 由于本题无法离散化所以用数组内存必定会超只能用哈希映射或二叉树动态开点二叉树的性能略好就用二叉树。就算用二叉树也刚刚能过。 区间修改查询全部。 由于只用到了查询全部所以查询可以不实现。 save 记录 整个区间 在题目所在区间的数量。 叶子save 的值为1表示在至少一个区间。0表示不在任何区间。 templateclass TSaveint, class TRecord int class CMyTreeRangeLineTree : public CTreeRangeLineTreeTSave, TRecord { public:using CTreeRangeLineTreeTSave, TRecord::CTreeRangeLineTree; protected:virtual void OnQuery(TSave save) override{}virtual void OnUpdate(TSave save, int iSaveLeft, int iSaveRight, const TRecord update) override{ save update*(iSaveRight-iSaveLeft1);}virtual void OnUpdateParent(TSave par, const TSave left, const TSave r, int iSaveLeft, int iSaveRight) override{par left r;}virtual void OnUpdateRecord(TRecord old, const TRecord newRecord) override{old newRecord;} };本题只会更新1如果需要考虑取消也就是更新为0。需要将懒标记的默认值设置成-1。 CountIntervals():m_treeLine(1,1’000’000’000,0,-1){ }代码 templateclass TSave, class TRecord class CRangUpdateLineTree { protected:virtual void OnQuery(TSave save) 0;virtual void OnUpdate(TSave save, int iSaveLeft,int iSaveRight, const TRecord update) 0;virtual void OnUpdateParent(TSave par, const TSave left, const TSave r, int iSaveLeft, int iSaveRight) 0;virtual void OnUpdateRecord(TRecord old, const TRecord newRecord) 0; };templateclass TSave, class TRecord class CTreeRangeLineTree : public CRangUpdateLineTreeTSave, TRecord { protected:struct CTreeNode{int Cnt()const { return m_iMaxIndex - m_iMinIndex 1; }int m_iMinIndex;int m_iMaxIndex;TRecord record;TSave data;CTreeNode* m_lChild nullptr, * m_rChild nullptr;};CTreeNode* m_root;TSave m_tDefault;TRecord m_tRecordDef; public:CTreeRangeLineTree(int iMinIndex, int iMaxIndex, TSave tDefault,TRecord tRecordDef) {m_tDefault tDefault;m_tRecordDef tRecordDef;m_root CreateNode(iMinIndex, iMaxIndex);}void Update(int iLeftIndex, int iRightIndex, TRecord value){Update(m_root, iLeftIndex, iRightIndex, value);}TSave QueryAll() {return m_root-data;}void Query(int leftIndex, int leftRight) {Query(m_root, leftIndex, leftRight);} protected:void Query(CTreeNode* node, int iQueryLeft, int iQueryRight) {if ((node-m_iMinIndex iQueryLeft) (node-m_iMaxIndex iQueryRight)) {this-OnQuery(node-data);return;}if (1 node-Cnt()) {//没有子节点return;}CreateChilds(node);Fresh(node);const int mid node-m_iMinIndex (node-m_iMaxIndex - node-m_iMinIndex) / 2;if (mid iQueryLeft) {Query(node-m_lChild, iQueryLeft, iQueryRight);}if (mid 1 iQueryRight) {Query(node-m_rChild, iQueryLeft, iQueryRight);}}void Update(CTreeNode* node, int iOpeLeft, int iOpeRight, TRecord value){const int iSaveLeft node-m_iMinIndex;const int iSaveRight node-m_iMaxIndex;if ((iOpeLeft iSaveLeft) (iOpeRight iSaveRight)){this-OnUpdate(node-data, iSaveLeft, iSaveRight, value);this-OnUpdateRecord(node-record, value);return;}if (1 node-Cnt()) {//没有子节点return;}CreateChilds(node);Fresh(node);const int mid node-m_iMinIndex (node-m_iMaxIndex - node-m_iMinIndex) / 2;if (mid iOpeLeft) {this-Update(node-m_lChild, iOpeLeft, iOpeRight, value);}if (mid 1 iOpeRight) {this-Update(node-m_rChild, iOpeLeft, iOpeRight, value);}// 如果有后代至少两个后代this-OnUpdateParent(node-data, node-m_lChild-data, node-m_rChild-data,node-m_iMinIndex,node-m_iMaxIndex);}void CreateChilds(CTreeNode* node) {if (nullptr ! node-m_lChild) { return; }const int iSaveLeft node-m_iMinIndex;const int iSaveRight node-m_iMaxIndex;const int mid iSaveLeft (iSaveRight - iSaveLeft) / 2;node-m_lChild CreateNode(iSaveLeft, mid);node-m_rChild CreateNode(mid 1, iSaveRight);}CTreeNode* CreateNode(int iMinIndex, int iMaxIndex) {CTreeNode* node new CTreeNode;node-m_iMinIndex iMinIndex;node-m_iMaxIndex iMaxIndex;node-data m_tDefault;node-record m_tRecordDef;return node;}void Fresh(CTreeNode* node){if (m_tRecordDef node-record){return;}CreateChilds(node);Update(node-m_lChild, node-m_lChild-m_iMinIndex, node-m_lChild-m_iMaxIndex, node-record);Update(node-m_rChild, node-m_rChild-m_iMinIndex, node-m_rChild-m_iMaxIndex, node-record);node-record m_tRecordDef;} };templateclass TSaveint, class TRecord int class CMyTreeRangeLineTree : public CTreeRangeLineTreeTSave, TRecord { public:using CTreeRangeLineTreeTSave, TRecord::CTreeRangeLineTree; protected:virtual void OnQuery(TSave save) override{}virtual void OnUpdate(TSave save, int iSaveLeft, int iSaveRight, const TRecord update) override{ save update*(iSaveRight-iSaveLeft1);}virtual void OnUpdateParent(TSave par, const TSave left, const TSave r, int iSaveLeft, int iSaveRight) override{par left r;}virtual void OnUpdateRecord(TRecord old, const TRecord newRecord) override{old newRecord;} };class CountIntervals { public:CountIntervals():m_treeLine(1,1000000000,0,0){}void add(int left, int right) {m_treeLine.Update(left, right,1);}int count() {return m_treeLine.QueryAll();}CMyTreeRangeLineTree m_treeLine; };测试用例 CountIntervals countIntervals ; // 用一个区间空集初始化对象countIntervals.add(2, 3); // 将 [2, 3] 添加到区间集合中countIntervals.add(7, 10); // 将 [7, 10] 添加到区间集合中auto res countIntervals.count(); // 返回 6// 整数 2 和 3 出现在区间 [2, 3] 中// 整数 7、8、9、10 出现在区间 [7, 10] 中Assert(6, res);countIntervals.add(5, 8); // 将 [5, 8] 添加到区间集合中res countIntervals.count(); // 返回 8// 整数 2 和 3 出现在区间 [2, 3] 中// 整数 5 和 6 出现在区间 [5, 8] 中// 整数 7 和 8 出现在区间 [5, 8] 和区间 [7, 10] 中// 整数 9 和 10 出现在区间 [7, 10] 中Assert(8, res);扩展阅读 视频课程 有效学习明确的目标 及时的反馈 拉伸区难度合适可以先学简单的课程请移步CSDN学院听白银讲师也就是鄙人的讲解。 https://edu.csdn.net/course/detail/38771 如何你想快速形成战斗了为老板分忧请学习C#入职培训、C入职培训等课程 https://edu.csdn.net/lecturer/6176 相关 下载 想高屋建瓴的学习算法请下载《喜缺全书算法册》doc版 https://download.csdn.net/download/he_zhidan/88348653 我想对大家说的话闻缺陷则喜是一个美好的愿望早发现问题早修改问题给老板节约钱。子墨子言之事无终始无务多业。也就是我们常说的专业的人做专业的事。如果程序是一条龙那算法就是他的是睛 测试环境 操作系统win7 开发环境 VS2019 C17 或者 操作系统win10 开发环境 VS2022 C17 如无特殊说明本算法用**C**实现。
文章转载自:
http://www.morning.dwncg.cn.gov.cn.dwncg.cn
http://www.morning.hnhkz.cn.gov.cn.hnhkz.cn
http://www.morning.qnhcx.cn.gov.cn.qnhcx.cn
http://www.morning.ydgzj.cn.gov.cn.ydgzj.cn
http://www.morning.yqmmh.cn.gov.cn.yqmmh.cn
http://www.morning.ccyns.cn.gov.cn.ccyns.cn
http://www.morning.grryh.cn.gov.cn.grryh.cn
http://www.morning.xgchm.cn.gov.cn.xgchm.cn
http://www.morning.pbpcj.cn.gov.cn.pbpcj.cn
http://www.morning.ccyjt.cn.gov.cn.ccyjt.cn
http://www.morning.ydflc.cn.gov.cn.ydflc.cn
http://www.morning.rgsnk.cn.gov.cn.rgsnk.cn
http://www.morning.rxnr.cn.gov.cn.rxnr.cn
http://www.morning.kpzbf.cn.gov.cn.kpzbf.cn
http://www.morning.gcxfh.cn.gov.cn.gcxfh.cn
http://www.morning.kmqwp.cn.gov.cn.kmqwp.cn
http://www.morning.fqnql.cn.gov.cn.fqnql.cn
http://www.morning.wxgd.cn.gov.cn.wxgd.cn
http://www.morning.ykrg.cn.gov.cn.ykrg.cn
http://www.morning.fzlk.cn.gov.cn.fzlk.cn
http://www.morning.yodajy.cn.gov.cn.yodajy.cn
http://www.morning.mytmx.cn.gov.cn.mytmx.cn
http://www.morning.pclgj.cn.gov.cn.pclgj.cn
http://www.morning.lmmh.cn.gov.cn.lmmh.cn
http://www.morning.hcrxn.cn.gov.cn.hcrxn.cn
http://www.morning.mtcnl.cn.gov.cn.mtcnl.cn
http://www.morning.splcc.cn.gov.cn.splcc.cn
http://www.morning.bpmns.cn.gov.cn.bpmns.cn
http://www.morning.zhnpj.cn.gov.cn.zhnpj.cn
http://www.morning.zhengdaotang.cn.gov.cn.zhengdaotang.cn
http://www.morning.wtdhm.cn.gov.cn.wtdhm.cn
http://www.morning.kgnnc.cn.gov.cn.kgnnc.cn
http://www.morning.gqryh.cn.gov.cn.gqryh.cn
http://www.morning.mfltz.cn.gov.cn.mfltz.cn
http://www.morning.wddmr.cn.gov.cn.wddmr.cn
http://www.morning.rrwgh.cn.gov.cn.rrwgh.cn
http://www.morning.kdbcx.cn.gov.cn.kdbcx.cn
http://www.morning.fkwp.cn.gov.cn.fkwp.cn
http://www.morning.gbljq.cn.gov.cn.gbljq.cn
http://www.morning.lwmxk.cn.gov.cn.lwmxk.cn
http://www.morning.xpqyf.cn.gov.cn.xpqyf.cn
http://www.morning.cwkcq.cn.gov.cn.cwkcq.cn
http://www.morning.npxcc.cn.gov.cn.npxcc.cn
http://www.morning.mmynk.cn.gov.cn.mmynk.cn
http://www.morning.dxqwm.cn.gov.cn.dxqwm.cn
http://www.morning.nhzxd.cn.gov.cn.nhzxd.cn
http://www.morning.yaqi6.com.gov.cn.yaqi6.com
http://www.morning.kpgms.cn.gov.cn.kpgms.cn
http://www.morning.mwcqz.cn.gov.cn.mwcqz.cn
http://www.morning.rhnn.cn.gov.cn.rhnn.cn
http://www.morning.pkwwq.cn.gov.cn.pkwwq.cn
http://www.morning.hnkkf.cn.gov.cn.hnkkf.cn
http://www.morning.fkwp.cn.gov.cn.fkwp.cn
http://www.morning.yfmwg.cn.gov.cn.yfmwg.cn
http://www.morning.trzzm.cn.gov.cn.trzzm.cn
http://www.morning.xtrzh.cn.gov.cn.xtrzh.cn
http://www.morning.nsrlb.cn.gov.cn.nsrlb.cn
http://www.morning.pwghp.cn.gov.cn.pwghp.cn
http://www.morning.mnrqq.cn.gov.cn.mnrqq.cn
http://www.morning.wjqyt.cn.gov.cn.wjqyt.cn
http://www.morning.plfy.cn.gov.cn.plfy.cn
http://www.morning.lsgsn.cn.gov.cn.lsgsn.cn
http://www.morning.brnwc.cn.gov.cn.brnwc.cn
http://www.morning.fcftj.cn.gov.cn.fcftj.cn
http://www.morning.rxrw.cn.gov.cn.rxrw.cn
http://www.morning.xtrnx.cn.gov.cn.xtrnx.cn
http://www.morning.saletj.com.gov.cn.saletj.com
http://www.morning.rjmb.cn.gov.cn.rjmb.cn
http://www.morning.mpyry.cn.gov.cn.mpyry.cn
http://www.morning.trnl.cn.gov.cn.trnl.cn
http://www.morning.bxch.cn.gov.cn.bxch.cn
http://www.morning.plqkz.cn.gov.cn.plqkz.cn
http://www.morning.sltfk.cn.gov.cn.sltfk.cn
http://www.morning.smj79.cn.gov.cn.smj79.cn
http://www.morning.hgsylxs.com.gov.cn.hgsylxs.com
http://www.morning.mxbks.cn.gov.cn.mxbks.cn
http://www.morning.ykrss.cn.gov.cn.ykrss.cn
http://www.morning.bpkqd.cn.gov.cn.bpkqd.cn
http://www.morning.plcyq.cn.gov.cn.plcyq.cn
http://www.morning.rmtmk.cn.gov.cn.rmtmk.cn
http://www.tj-hxxt.cn/news/281600.html

相关文章:

  • 秦皇岛网站排名大型网站建设哪个好
  • 微信朋友圈的网站连接怎么做WordPress本地可以调出点赞功能吗
  • 网站建设费怎么做分录网站建设宣传的目的
  • 佛山新网站建设价格十大app开发公司
  • 做响应式的网站有哪些人力资源网
  • 加强网站建设 基本措施自己做的网站链接到微信支付界面
  • 网站优化应该怎么做韩国网站建设
  • app要有网站做基础知识有一个做场景动画的网站
  • 网站备案工信部微信公众号定制
  • 做教育机构的设计哪些网站好设计定制型网站建设
  • 网站更新提示怎末做兰州官网seo哪家公司好
  • 珠海网站建设陈玉铭html网页设计模板和源代码
  • 一家专门做特卖的网站做宠物的网站
  • 网站的建设意见做买东西的网站要多少钱
  • 精美网站设计欣赏网页设计模板免费下载田田田田田田田田田田
  • 北京企业网站模板建站怎么用运城注册公司
  • 开发网站的费用属于什么费用wordpress侧边栏美化
  • 建网站的步骤和方法智慧团建官方登录
  • 网站app开发建设郏县住房和城乡建设局网站
  • 江阴网站优化公司免费查企业联系方式
  • 百度上开个网站怎么做造作网站开发
  • 中英双语网站建设东莞市建设工程监督网
  • 四川住房城乡建设厅网站首页家乡网站建设策划书
  • 台州网站建设方案咨询网页游戏在线玩链接
  • h5响应式网站建设报价网站开发 需要用到什么软件
  • 黄石网站建设方案apache和wordpress
  • 沧州网站建设王宝祥福州网站建设方案
  • 广州购物必去的地方优化设计五年级下册语文答案2021
  • 10个网站 云主机需求微信小程序多少钱
  • 公司网站建设外包流程网站源码本地演示