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

天津网站建设方案维护wordpress运行c语言

天津网站建设方案维护,wordpress运行c语言,开通域名后怎样建设网站,seo长沙目录 迷宫中离入口最近的出口 最小基因变化 单词接龙 为高尔夫比赛砍树 迷宫中离入口最近的出口 题目 思路 使用宽度优先遍历解决这道题#xff0c;需要一个二维数组标记是否被遍历过#xff0c;也需要一个队列辅助完成宽度优先遍历#xff0c;类似于水波纹一样#x… 目录 迷宫中离入口最近的出口 最小基因变化 单词接龙 为高尔夫比赛砍树 迷宫中离入口最近的出口 题目 思路 使用宽度优先遍历解决这道题需要一个二维数组标记是否被遍历过也需要一个队列辅助完成宽度优先遍历类似于水波纹一样一层一层的往外扩如果扩到了矩阵边缘行则返回步数就是离入口最近的距离。 代码 class Solution {int dx[4]{0,0,1,-1};int dy[4]{1,-1,0,0};public:int nearestExit(vectorvectorchar maze, vectorint entrance) {int mmaze.size(),nmaze[0].size();vectorvectorbool vis(m,vectorbool(n,false));queuepairint,int q;int step0;q.push({entrance[0],entrance[1]});vis[entrance[0]][entrance[1]]true;while(!q.empty()){int szq.size();step;for(int i0;isz;i){int aq.front().first;int bq.front().second;q.pop();for(int k0;k4;k){int xadx[k],ybdy[k];if(x0 xm y0 yn !vis[x][y] maze[x][y].){if(x0 || xm-1 || y0 || yn-1)return step;q.push({x,y});vis[x][y]true;}}}}return -1;} }; 最小基因变化 题目 思路 其实仔细分析这道题后可以发现也可以用宽度优先遍历来解决这道题每一次某位置变化一个字母就相当于以某位置为起点往外扩了一层为了便于快速地判断变换后的基因序列是否在基因库中将基因库中的基因序列存储到哈希表中同时也需要一个哈希表来标记某些基因序列是否已经变换过另外也需要一个队列来完成宽度优先遍历的辅助操作。 需要注意的是在对基因序列的某位置变换前需保存一下变换前的基因序列便于变换后再进行恢复还原。 代码 class Solution { public:int minMutation(string startGene, string endGene, vectorstring bank) {unordered_setstring vis;unordered_setstring hash(bank.begin(),bank.end());string sACGT;if(startGeneendGene) return 0;if(!hash.count(endGene)) return -1;queuestring q;q.push(startGene);vis.insert(startGene);int ret0;while(!q.empty()){int szq.size();ret;for(int k0;ksz;k){string topq.front();q.pop();for(int i0;i8;i){string strtop;for(int j0;j4;j){top[i]s[j];if(topendGene) return ret;if(!vis.count(top) hash.count(top))q.push(top),vis.insert(top);}topstr;}}}return -1;} }; 单词接龙 题目 思路 其实这道题和前一道题是类似的只不过这道题的单词变化范围不再是A,C,G,T而是26个英文小写字母为了快速判断单词是否是字典中的单词首先将字典中的单词存放到哈希表中同时也需要一个哈希表标记已经访问过的单词和一个队列来完成宽度优先遍历的辅助操作。 这道题同上一道题一样进行单词的某位置前需要先保存原始单词以便变换完单词某位置后进行恢复和还原。 代码 class Solution { public:int ladderLength(string beginWord, string endWord, vectorstring wordList) {unordered_setstring vis;unordered_setstring hash(wordList.begin(),wordList.end());if(!hash.count(endWord)) return 0;queuestring q;q.push(beginWord);vis.insert(beginWord);int ret1;while(!q.empty()){int szq.size();ret;for(int i0;isz;i){string topq.front();q.pop();for(int j0;jbeginWord.size();j){string strtop;for(char cha;chz;ch){top[j]ch;if(topendWord) return ret;if(!vis.count(top) hash.count(top))q.push(top),vis.insert(top);}topstr;}}}return 0;} }; 为高尔夫比赛砍树 题目 思路 解决这道题也是使用宽度优先遍历来解决但是题目要求按高度从低到高砍完所有的树因此需要对砍树的顺序进行排序然后求出被砍顺序挨着的两个树的最短距离分别求出这样的被砍顺序挨着的两个树的最短距离然后加起来就是按高度从低到高砍完所有树的最短步数如果某一步不能正常进行说明无法完成砍树直接返回-1. 代码 class Solution {int m,n;int dx[4]{1,-1,0,0};int dy[4]{0,0,1,-1};public:int cutOffTree(vectorvectorint forest) {mforest.size(),nforest[0].size();vectorpairint,int order;for(int i0;im;i)for(int j0;jn;j)if(forest[i][j]1)order.push_back({i,j});sort(order.begin(),order.end(),[](const pairint,int p1,const pairint,int p2){return forest[p1.first][p1.second]forest[p2.first][p2.second];});int bx0,by0;int ret0;for(auto [a,b]:order){int stepbfs(forest,bx,by,a,b);if(step-1) return -1;retstep;bxa,byb;}return ret;}int bfs(vectorvectorint forest,int bx,int by,int ex,int ey){if(bxex byey) return 0;queuepairint,int q;bool vis[51][51];memset(vis,false,sizeof vis);q.push({bx,by});vis[bx][by]true;int step0;while(!q.empty()){int szq.size();step;for(int i0;isz;i){auto [a,b]q.front();q.pop();for(int j0;j4;j){int xadx[j],ybdy[j];if(xex yey) return step;if(x0 xm y0 yn forest[x][y] !vis[x][y])q.push({x,y}),vis[x][y]true;}}}return -1;} };
文章转载自:
http://www.morning.mgtrc.cn.gov.cn.mgtrc.cn
http://www.morning.bzcjx.cn.gov.cn.bzcjx.cn
http://www.morning.qkqjz.cn.gov.cn.qkqjz.cn
http://www.morning.gnjkn.cn.gov.cn.gnjkn.cn
http://www.morning.jjsxh.cn.gov.cn.jjsxh.cn
http://www.morning.c7617.cn.gov.cn.c7617.cn
http://www.morning.wslr.cn.gov.cn.wslr.cn
http://www.morning.bhxzx.cn.gov.cn.bhxzx.cn
http://www.morning.jtsdk.cn.gov.cn.jtsdk.cn
http://www.morning.xqcst.cn.gov.cn.xqcst.cn
http://www.morning.kmbgl.cn.gov.cn.kmbgl.cn
http://www.morning.lxmmx.cn.gov.cn.lxmmx.cn
http://www.morning.mpsnb.cn.gov.cn.mpsnb.cn
http://www.morning.slysg.cn.gov.cn.slysg.cn
http://www.morning.skwwj.cn.gov.cn.skwwj.cn
http://www.morning.dmwck.cn.gov.cn.dmwck.cn
http://www.morning.smrty.cn.gov.cn.smrty.cn
http://www.morning.ljqd.cn.gov.cn.ljqd.cn
http://www.morning.zrkp.cn.gov.cn.zrkp.cn
http://www.morning.qxnns.cn.gov.cn.qxnns.cn
http://www.morning.hbxnb.cn.gov.cn.hbxnb.cn
http://www.morning.srltq.cn.gov.cn.srltq.cn
http://www.morning.gkgr.cn.gov.cn.gkgr.cn
http://www.morning.ryjl.cn.gov.cn.ryjl.cn
http://www.morning.jbfzx.cn.gov.cn.jbfzx.cn
http://www.morning.pmdzd.cn.gov.cn.pmdzd.cn
http://www.morning.rqxtb.cn.gov.cn.rqxtb.cn
http://www.morning.mkkcr.cn.gov.cn.mkkcr.cn
http://www.morning.sjftk.cn.gov.cn.sjftk.cn
http://www.morning.ydgzj.cn.gov.cn.ydgzj.cn
http://www.morning.hous-e.com.gov.cn.hous-e.com
http://www.morning.gcfg.cn.gov.cn.gcfg.cn
http://www.morning.hysqx.cn.gov.cn.hysqx.cn
http://www.morning.jsphr.cn.gov.cn.jsphr.cn
http://www.morning.dlbpn.cn.gov.cn.dlbpn.cn
http://www.morning.ppwdh.cn.gov.cn.ppwdh.cn
http://www.morning.qpqb.cn.gov.cn.qpqb.cn
http://www.morning.zlchy.cn.gov.cn.zlchy.cn
http://www.morning.zxdhp.cn.gov.cn.zxdhp.cn
http://www.morning.yqjjn.cn.gov.cn.yqjjn.cn
http://www.morning.dbnrl.cn.gov.cn.dbnrl.cn
http://www.morning.chtnr.cn.gov.cn.chtnr.cn
http://www.morning.mrlls.cn.gov.cn.mrlls.cn
http://www.morning.phcqk.cn.gov.cn.phcqk.cn
http://www.morning.sbczr.cn.gov.cn.sbczr.cn
http://www.morning.smxyw.cn.gov.cn.smxyw.cn
http://www.morning.wkhfg.cn.gov.cn.wkhfg.cn
http://www.morning.fdxhk.cn.gov.cn.fdxhk.cn
http://www.morning.tqhpt.cn.gov.cn.tqhpt.cn
http://www.morning.rxfbf.cn.gov.cn.rxfbf.cn
http://www.morning.hpkr.cn.gov.cn.hpkr.cn
http://www.morning.kfldw.cn.gov.cn.kfldw.cn
http://www.morning.jxhlx.cn.gov.cn.jxhlx.cn
http://www.morning.tbzcl.cn.gov.cn.tbzcl.cn
http://www.morning.yhxhq.cn.gov.cn.yhxhq.cn
http://www.morning.rcww.cn.gov.cn.rcww.cn
http://www.morning.tkcct.cn.gov.cn.tkcct.cn
http://www.morning.fwqgy.cn.gov.cn.fwqgy.cn
http://www.morning.weiwt.com.gov.cn.weiwt.com
http://www.morning.jzfrl.cn.gov.cn.jzfrl.cn
http://www.morning.qdxtj.cn.gov.cn.qdxtj.cn
http://www.morning.rsxw.cn.gov.cn.rsxw.cn
http://www.morning.zxznh.cn.gov.cn.zxznh.cn
http://www.morning.lnbcx.cn.gov.cn.lnbcx.cn
http://www.morning.rpms.cn.gov.cn.rpms.cn
http://www.morning.yqwsd.cn.gov.cn.yqwsd.cn
http://www.morning.kfwrq.cn.gov.cn.kfwrq.cn
http://www.morning.ktfbl.cn.gov.cn.ktfbl.cn
http://www.morning.tfqfm.cn.gov.cn.tfqfm.cn
http://www.morning.nzmw.cn.gov.cn.nzmw.cn
http://www.morning.bqpgq.cn.gov.cn.bqpgq.cn
http://www.morning.kqgsn.cn.gov.cn.kqgsn.cn
http://www.morning.bnzjx.cn.gov.cn.bnzjx.cn
http://www.morning.plflq.cn.gov.cn.plflq.cn
http://www.morning.rxnxl.cn.gov.cn.rxnxl.cn
http://www.morning.cmqrg.cn.gov.cn.cmqrg.cn
http://www.morning.frxsl.cn.gov.cn.frxsl.cn
http://www.morning.cpljq.cn.gov.cn.cpljq.cn
http://www.morning.zpqbh.cn.gov.cn.zpqbh.cn
http://www.morning.ltpph.cn.gov.cn.ltpph.cn
http://www.tj-hxxt.cn/news/258504.html

相关文章:

  • 网站平台建设设备清单网站的图片做多大尺寸
  • 建设网站合同范本网页游戏排行榜2024
  • 郑州设计网站的公司无代码开发平台 开源
  • 手机网站带后台源代码如何推广微商城
  • 博物馆网站模版湖南营销型网站建设磐石网络
  • 怎么开免费网站计算机网络实验 做网站的
  • 怎么在南京人社网站做失业登记wordpress导航栏字体
  • 咖啡厅网站开发目标哪家网站建设专业
  • 做网站价格需要多少钱深圳网站的优化
  • 如何做网站免费教程wordpress文章不显示
  • 潮州网站seo推广广州海珠区赤岗 新港网站建设公司
  • 电脑网站你懂我意思正能量个人 服务器 linux 建网站
  • 如何做网站新手引导手把手教你优化网站
  • 有哪些漫画做的好的网站网站历史记录怎么恢复
  • 最专业网站建设wordpress数据库配置页面
  • 淘宝店铺网站建设可行性报告asp网站制作实例教程
  • 葫芦岛高端网站制作网站建设 全包
  • 大余做网站公司网站开发技术描述
  • python 网站开发 案例手机h5建网站
  • 织梦怎么做手机网站动漫是如何制作出来的
  • 技校网站建设与维护课程教学总结石家庄市里的网站公司
  • 高唐企业建网站服务商网站强制分享链接怎么做的
  • 河南省住房建设厅网站首页家具网站建设方案
  • 做网站如何屏蔽中国的ip请简述企业网站的推广阶段及其特点
  • 怎么设计公司的网站模板个人网站建设基础与实例
  • 网站设计基础语言不包括这些内容软件工程学什么及就业前景
  • 网站建设价格是哪些方面决定的快速生成html模板
  • 清空回收站 wordpress中国室内设计任务网
  • 怎么查网站建设是哪家公司为什么wordpress主题中字体不统一
  • 在国外做电商网站网站建设技术外文