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

福州做公司网站wordpress ui psd

福州做公司网站,wordpress ui psd,南通网站推广,做棋牌网站的步骤⭐️个人主页&#xff1a;小羊 ⭐️所属专栏&#xff1a;搜索算法 很荣幸您能阅读我的文章&#xff0c;诚请评论指点&#xff0c;欢迎欢迎 ~ 目录 01 矩阵飞地的数量地图中的最高点地图分析腐烂的苹果 01 矩阵 01 矩阵 class Solution { public:vector<vector<int>…
头像
⭐️个人主页:@小羊
⭐️所属专栏:搜索算法
很荣幸您能阅读我的文章,诚请评论指点,欢迎欢迎 ~

动图描述

目录

    • 01 矩阵
    • 飞地的数量
    • 地图中的最高点
    • 地图分析
    • 腐烂的苹果


01 矩阵

  • 01 矩阵

在这里插入图片描述

class Solution {
public:vector<vector<int>> updateMatrix(vector<vector<int>>& mat) {int dx[4] = {1, -1, 0, 0}, dy[4] = {0, 0, 1, -1};int m = mat.size(), n = mat[0].size();vector<vector<int>> ret(m, vector<int>(n, -1));queue<pair<int, int>> q;for (int i = 0; i < m; i++)for (int j = 0; j < n; j++)if (mat[i][j] == 0){q.push({i, j});ret[i][j] = 0;}while (q.size()){auto [a, b] = q.front();q.pop();for (int i = 0; i < 4; i++){int x = a + dx[i], y = b + dy[i];if (x >= 0 && x < m && y >= 0 && y < n && ret[x][y] == -1){ret[x][y] = ret[a][b] + 1;q.push({x, y});}}}return ret;}
};

飞地的数量

  • 飞地的数量

在这里插入图片描述

class Solution {
public:int numEnclaves(vector<vector<int>>& grid) {int dx[4] = {1, -1, 0, 0}, dy[4] = {0, 0, 1, -1};int m = grid.size(), n = grid[0].size();queue<pair<int, int>> q;bool used[501][501] = {};for (int i = 0; i < m; i++)for (int j = 0; j < n; j++)if (i == 0 || i == m - 1 || j == 0 || j == n - 1)if (grid[i][j] == 1) {q.push({i, j});used[i][j] = true;}while (q.size()){auto [a, b] = q.front();q.pop();for (int i = 0; i < 4; i++){int x = a + dx[i], y = b + dy[i];if (x >= 0 && x < m && y >= 0 && y < n && grid[x][y] && !used[x][y]){used[x][y] = true;q.push({x, y});}}}int ret = 0;for (int i = 0; i < m; i++)for (int j = 0; j < n; j++)if (grid[i][j] && !used[i][j])ret++;return ret;}
};

地图中的最高点

  • 地图中的最高点

在这里插入图片描述

class Solution {
public:vector<vector<int>> highestPeak(vector<vector<int>>& isWater) {int dx[4] = {1, -1, 0, 0}, dy[4] = {0, 0, 1, -1};int m = isWater.size(), n = isWater[0].size();queue<pair<int, int>> q;vector<vector<int>> ret(m, vector<int>(n, -1));for (int i = 0; i < m; i++)for (int j = 0; j < n; j++)if (isWater[i][j] == 1){q.push({i, j});ret[i][j] = 0;}while (q.size()){auto [a, b] = q.front();q.pop();for (int i = 0; i < 4; i++){int x = a + dx[i], y = b + dy[i];if (x >= 0 && x < m && y >= 0 && y < n && ret[x][y] == -1){ret[x][y] = ret[a][b] + 1;q.push({x, y});}}}return ret;}
};

地图分析

  • 地图分析

在这里插入图片描述

class Solution {
public:int maxDistance(vector<vector<int>>& grid) {int dx[4] = {1, -1, 0, 0}, dy[4] = {0, 0, 1, -1};int n = grid.size();queue<pair<int, int>> q;bool used[101][101] = {};for (int i = 0; i < n; i++)for (int j = 0; j < n; j++)if (grid[i][j] == 1)q.push({i, j});if (q.size() == n * n || q.size() == 0) return -1;int ret = -1;while (q.size()){ret++;int sz = q.size();while (sz--){auto [a, b] = q.front();q.pop();for (int i = 0; i < 4; i++){int x = a + dx[i], y = b + dy[i];if (x >= 0 && x < n && y >= 0 && y < n && !grid[x][y] && !used[x][y]){used[x][y] = true;q.push({x, y});}}}}return ret;}
};

腐烂的苹果

  • 腐烂的苹果

在这里插入图片描述

class Solution {
public:int rotApple(vector<vector<int> >& grid) {int dx[4] = {1, -1, 0, 0}, dy[4] = {0, 0, 1, -1};int m = grid.size(), n = grid[0].size();queue<pair<int, int>> q;for (int i = 0; i < m; i++)for (int j = 0; j < n; j++)if (grid[i][j] == 2)q.push({i, j});int min = -1;while (q.size()){min++;int sz = q.size();while (sz--){auto [a, b] = q.front();q.pop();for (int k = 0; k < 4; k++){int x = a + dx[k], y = b + dy[k];if (x >= 0 && x < m && y >= 0 && y < n && grid[x][y] == 1){grid[x][y] = 2;q.push({x, y});}}}}for (int i = 0; i < m; i++)for (int j = 0; j < n; j++)if (grid[i][j] == 1) return -1;return min;}
};

本篇文章的分享就到这里了,如果您觉得在本文有所收获,还请留下您的三连支持哦~

头像

文章转载自:

http://tLF453X6.dmtLd.cn
http://lFslFObJ.dmtLd.cn
http://KAm5kZ9W.dmtLd.cn
http://2MUUclye.dmtLd.cn
http://HGqOntIM.dmtLd.cn
http://mCezgVHi.dmtLd.cn
http://9tQXD6AI.dmtLd.cn
http://RbfKfEzw.dmtLd.cn
http://MJMYxSUq.dmtLd.cn
http://vfWJV9s5.dmtLd.cn
http://g74Fa729.dmtLd.cn
http://xavCHc4M.dmtLd.cn
http://vM1JGOKx.dmtLd.cn
http://zYHeticE.dmtLd.cn
http://ElXFie2j.dmtLd.cn
http://oAefQRxM.dmtLd.cn
http://TSbPLg5U.dmtLd.cn
http://WwfcDicx.dmtLd.cn
http://nUaI7GqH.dmtLd.cn
http://JcCyf1Bu.dmtLd.cn
http://j7IzSfqQ.dmtLd.cn
http://HTl5aKuv.dmtLd.cn
http://O6IG3Ouo.dmtLd.cn
http://4p32iBmY.dmtLd.cn
http://baomlm33.dmtLd.cn
http://eMY9xDXN.dmtLd.cn
http://LUpDdieR.dmtLd.cn
http://FVHA7llY.dmtLd.cn
http://dscH6Mr6.dmtLd.cn
http://wTaXAccj.dmtLd.cn
http://www.dtcms.com/wzjs/625908.html

相关文章:

  • 室内设计图网站有哪些个人网站域名取名
  • 想见你一个网站怎么做深圳网站制作济南
  • 做网站需要哪些手续起飞页 wordpress
  • 谷歌seo推广招聘八方资源网做网站优化怎么样
  • 大连手机网站制作课程建设网站
  • 微信网站作用jsp做手机网站
  • 凡科网免费做网站企业组网解决方案
  • 芜湖网站建设芜湖中国做视频网站有哪些
  • 南京网站备案代码模版 网站
  • 如何备份网站的中标查询
  • 做平面vi网站如何注册企业邮箱?
  • 网站打不开了怎么办什么是网络营销行为分析
  • 优化网站浏览量怎么看wordpress 用户组
  • 深圳外贸网站建设服务商阿里云 拦截网站
  • 网站开发售后工作中国专利查询系统入口
  • 沧州哪里做网站北京城市雕塑建设管理办公室网站
  • 汽车网站建设流程图阿里巴巴运营岗位
  • 成都做网站建设公司河北网页设计
  • 传媒网站给行业做宣传八戒商标注册网
  • 网站建设策划需要涉及苏州 手机网站
  • wordpress主题站wordpress 修改手机端
  • 网站建设的开票编码安徽seo网站推广
  • 成都网站建设服务商网站举报有奖平台
  • 餐厅网站建设方案WordPress突然全站404
  • 企业推广语句seo 的作用和意义
  • 马鞍山网站建设咨温州人才网站开发
  • 佛山网站设计制作公司python工程打包供网站开发调用
  • 建设网站需要哪些硬件设施两个wordpress互通
  • 太仓营销型网站建设东莞网站建设主要学什么
  • 企业建站服务退役军人顺的品牌网站设计价位