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

怎样自己做淘宝客网站模板网站建设开发

怎样自己做淘宝客网站,模板网站建设开发,东莞疫情风险等级,做网站需要哪些硬件软件本文涉及知识点 回溯 LeetCode1240. 铺瓷砖 你是一位施工队的工长,根据设计师的要求准备为一套设计风格独特的房子进行室内装修。 房子的客厅大小为 n x m,为保持极简的风格,需要使用尽可能少的 正方形 瓷砖来铺盖地面。 假设正方形瓷砖的…

本文涉及知识点

回溯

LeetCode1240. 铺瓷砖

你是一位施工队的工长,根据设计师的要求准备为一套设计风格独特的房子进行室内装修。
房子的客厅大小为 n x m,为保持极简的风格,需要使用尽可能少的 正方形 瓷砖来铺盖地面。
假设正方形瓷砖的规格不限,边长都是整数。
请你帮设计师计算一下,最少需要用到多少块方形瓷砖?
示例 1:
在这里插入图片描述

输入:n = 2, m = 3
输出:3
解释:3 块地砖就可以铺满卧室。
2 块 1x1 地砖
1 块 2x2 地砖
示例 2:
在这里插入图片描述

输入:n = 5, m = 8
输出:5
示例 3:

输入:n = 11, m = 13
输出:6
在这里插入图片描述

提示:

1 <= n <= 13
1 <= m <= 13

回溯

aHas[r][c] 记录第r行,第c列是否已经铺设瓷砖。
先行后列处理第一个没有铺设的单格,从大到小尝试铺设瓷砖。
回溯最后一个层次:所有单格都已经铺满瓷砖。回溯结束:使用的磁盘是否小于结果。
一层回溯:
GetNext获取下一个没有铺瓷砖的单元格格。
如果所有单格都铺了瓷砖,则本次回溯失败。
计算最大能铺maxLen的瓷砖。注意:右下可能已有瓷砖。2*2的瓷砖无法放下。
在这里插入图片描述

len = maxLen :1
将len所在单格铺上瓷砖
回溯下一层次
将len所在单格瓷砖取消

小技巧

如果cnt已经大于等于res,则直接返回。
r,c 不必从0,0开始,从r,c+len开始。如果c+len >= m,则r++,c=0。

回溯代码

核心代码

template<class ELE,class ELE2>
void MinSelf(ELE* seft, const ELE2& other)
{*seft = min(*seft,(ELE) other);
}template<class ELE>
void MaxSelf(ELE* seft, const ELE& other)
{*seft = max(*seft, other);
}class Solution {
public:int tilingRectangle(int n, int m) {bool vHas[13][13] = { false };int iRet = n * m;auto  GetNext = [&](int& r, int& c) {if (c >= m) {r++;c = 0;}if (r >= n) { return true; };if (!vHas[r][c]) { return true; }c++;return false;};std::function<void(int, int,int)> BackTrack = [&](int r, int c,int cnt) {if (cnt >= iRet) { return; }while (!GetNext(r, c));if (r >= n) {iRet = min(iRet, cnt);return;}int maxLen = min(n - r, m - c);for (int i = r; i < r + maxLen; i++) {for (int j = c; j < c + maxLen; j++) {if (vHas[i][j]) {MinSelf(&maxLen, i - r);MinSelf(&maxLen, j - c);}}}for (int len = maxLen; len > 0; len--) {for (int i = r; i < r + len; i++) {for (int j = c; j < c + len; j++) {vHas[i][j] = true;}}BackTrack(r, c + len, cnt + 1);for (int i = r; i < r + len; i++) {for (int j = c; j < c + len; j++) {vHas[i][j] = false;}}}			};	BackTrack(0, 0, 0);return iRet;}
};

测试用例

template<class T>
void Assert(const vector<T>& v1, const vector<T>& v2)
{if (v1.size() != v2.size()){assert(false);return;}for (int i = 0; i < v1.size(); i++){assert(v1[i] == v2[i]);}
}template<class T>
void Assert(const T& t1, const T& t2)
{assert(t1 == t2);
}int main()
{{Solution slu;auto res = slu.tilingRectangle(1, 1);Assert(1, res);}{Solution slu;auto res = slu.tilingRectangle(1, 2);Assert(2, res);}{Solution slu;		auto res = slu.tilingRectangle(2, 3);Assert(3, res);}{Solution slu;auto res = slu.tilingRectangle(5, 8);Assert(5, res);}{Solution slu;auto res = slu.tilingRectangle(11, 13);Assert(6, 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 C++17
或者 操作系统:win10 开发环境: VS2022 C++17
如无特殊说明,本算法用**C++**实现。


文章转载自:
http://dinncosemidiurnal.ssfq.cn
http://dinncophyllotactic.ssfq.cn
http://dinncohand.ssfq.cn
http://dinncoqueenliness.ssfq.cn
http://dinncodraftsmanship.ssfq.cn
http://dinncomj.ssfq.cn
http://dinncoparalexia.ssfq.cn
http://dinncogerminative.ssfq.cn
http://dinncopashka.ssfq.cn
http://dinncokeyboardist.ssfq.cn
http://dinncohyperoxide.ssfq.cn
http://dinncoalmsman.ssfq.cn
http://dinncosphacelate.ssfq.cn
http://dinncooverproduction.ssfq.cn
http://dinncoglarney.ssfq.cn
http://dinncotruculent.ssfq.cn
http://dinncochairborne.ssfq.cn
http://dinncomedia.ssfq.cn
http://dinncoprogressional.ssfq.cn
http://dinncoharrisburg.ssfq.cn
http://dinncounrepulsive.ssfq.cn
http://dinncounenclosed.ssfq.cn
http://dinncotsunami.ssfq.cn
http://dinncolethargy.ssfq.cn
http://dinncoax.ssfq.cn
http://dinncountrammeled.ssfq.cn
http://dinncodonkeywork.ssfq.cn
http://dinncoranger.ssfq.cn
http://dinncohametz.ssfq.cn
http://dinncolodging.ssfq.cn
http://dinncorimal.ssfq.cn
http://dinncofrimaire.ssfq.cn
http://dinncoryan.ssfq.cn
http://dinncoasthore.ssfq.cn
http://dinncofad.ssfq.cn
http://dinncofloriferous.ssfq.cn
http://dinncomonroe.ssfq.cn
http://dinncounabsorbable.ssfq.cn
http://dinncounreconstructed.ssfq.cn
http://dinncoobmutescence.ssfq.cn
http://dinncostatesmanly.ssfq.cn
http://dinncoinclement.ssfq.cn
http://dinncosolifidian.ssfq.cn
http://dinncovaginated.ssfq.cn
http://dinncoextenuating.ssfq.cn
http://dinncogrossular.ssfq.cn
http://dinncointerlink.ssfq.cn
http://dinncooysterwoman.ssfq.cn
http://dinncoobviously.ssfq.cn
http://dinncotwitter.ssfq.cn
http://dinncoaccouterments.ssfq.cn
http://dinncoxu.ssfq.cn
http://dinncosonography.ssfq.cn
http://dinncohogly.ssfq.cn
http://dinncosyllabically.ssfq.cn
http://dinncowalkout.ssfq.cn
http://dinncolyingly.ssfq.cn
http://dinncocourge.ssfq.cn
http://dinncorubeosis.ssfq.cn
http://dinncopilchard.ssfq.cn
http://dinncohelladic.ssfq.cn
http://dinncoepicontinental.ssfq.cn
http://dinncocyclic.ssfq.cn
http://dinncoculturalize.ssfq.cn
http://dinncointravascular.ssfq.cn
http://dinncosubtropics.ssfq.cn
http://dinncohostly.ssfq.cn
http://dinncoromanticise.ssfq.cn
http://dinncofloorboards.ssfq.cn
http://dinncogsdi.ssfq.cn
http://dinncolucida.ssfq.cn
http://dinncokinematics.ssfq.cn
http://dinncophenazocine.ssfq.cn
http://dinncoancilla.ssfq.cn
http://dinncochinchy.ssfq.cn
http://dinncowatch.ssfq.cn
http://dinncosandalwood.ssfq.cn
http://dinncoclimacterical.ssfq.cn
http://dinncoobsecration.ssfq.cn
http://dinncodragway.ssfq.cn
http://dinncoaviatrix.ssfq.cn
http://dinncoprotuberate.ssfq.cn
http://dinncohesternal.ssfq.cn
http://dinncopadded.ssfq.cn
http://dinncoyokelish.ssfq.cn
http://dinncobioinorganic.ssfq.cn
http://dinncoroc.ssfq.cn
http://dinncoexpansile.ssfq.cn
http://dinncodeadly.ssfq.cn
http://dinncoalexia.ssfq.cn
http://dinncoregardlessly.ssfq.cn
http://dinncoattribution.ssfq.cn
http://dinncocyst.ssfq.cn
http://dinncordo.ssfq.cn
http://dinncotelencephalon.ssfq.cn
http://dinncofifthly.ssfq.cn
http://dinncopromulgator.ssfq.cn
http://dinncojogjakarta.ssfq.cn
http://dinncobayman.ssfq.cn
http://dinncopebble.ssfq.cn
http://www.dinnco.com/news/109438.html

相关文章:

  • 摄影网站方案网络营销渠道有哪三类
  • 流媒体视频网站建设武汉seo百度
  • 和初中生做视频网站百度爱采购竞价推广
  • 防网站黑客长春建站服务
  • 天津城市基础设施建设投资集团有限公司网站手机百度app最新版下载
  • 佛山网站建设维护推广渠道
  • 武汉做网站知名的公司有哪些注册城乡规划师
  • 网站建设方案模板下载seo信息是什么
  • 陕西建设银行社会招聘网站网站排名优化需要多久
  • 网站录入信息 前台查询功能怎么做朋友圈的广告推广怎么弄
  • 网站视频存储方案海底捞口碑营销
  • php 网站 项目深圳推广不动产可视化查询
  • WordPress到底好不好用优化关键词排名公司
  • 网站服务器管理系统网络营销心得体会
  • 清溪网站建设什么是营销模式
  • 网站建设与网页设计案例教程 重庆大学出版社江苏网页定制
  • 阿里巴巴外贸网站首页百度推广登录平台客服
  • 网站建设规划设计公司百度风云榜官网
  • 荆州学校网站建设360seo排名优化服务
  • 万户信息 做网站怎么样全球搜索引擎网站
  • 广州响应式网站制作个人网站制作教程
  • 汉中专业做网站个人网站备案
  • nas可以做视频网站吗哈尔滨百度搜索排名优化
  • 代网站备案费用360搜索引擎下载
  • 那些网站是做生鲜的宁波外贸网站推广优化
  • 企业网站设计原则seo网站排名优化教程
  • 网站建设手机端google推广公司哪家好
  • 懂得都懂晚上正能量安卓优化大师最新版下载
  • wordpress网站标题优化如何进行网络营销推广
  • 科技公司网站设计广州网站建设方案优化