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

做物流网站计划cn后缀做网站

做物流网站计划,cn后缀做网站,杭州网站建设公司推荐,郑州哪有做网站的公司样例#xff1a; 解法#xff1a; 1.遍历矩阵 2.判断矩阵[i][j]#xff0c;若是未标记细胞则遍历相邻所有未标记细胞并标记#xff0c;且计数 实现#xff1a;遍历相邻所有未标记细胞 以DFS实现#xff1a; function dfs(当前状态) {if (终止条件) {}vis[标记当前状… 样例 解法 1.遍历矩阵 2.判断矩阵[i][j]若是未标记细胞则遍历相邻所有未标记细胞并标记且计数 实现遍历相邻所有未标记细胞 以DFS实现 function dfs(当前状态) {if (终止条件) {}vis[标记当前状态]for (寻找新状态) {if (状态合法) {dfs(新状态)//看情况是否需要重置vis[]}} } 代码 #includeiostream #includevector using namespace std; int dir[4][2] { 0,1,1,0,-1,0,0,-1 }; void dfs(vectorvectorint a, int x, int y) {if (a[x][y] 0) return;a[x][y] 0;for (int i 0; i 4; i) {int nextx x dir[i][0];int nexty y dir[i][1];if (nextx 0 || nextx a.size() || nexty 0 || nexty a[0].size()) {continue;}if (a[nextx][nexty] ! 0) {dfs(a, nextx, nexty);}} } int main() {int m, n;cin m n;vectorvectorint a(m, vectorint(n , 0));for (int i 0; i m; i)for (int j 0; j n; j)cin a[i][j];int result 0;for (int i 0; i m; i) {for (int j 0; j n; j) {if (a[i][j] ! 0) {result;dfs(a, i, j);}}}cout result;return 0; } 以BFS实现 function bfs(当前节点) {当前节点入列标记当前节点while (队列不为空) {当前节点出列寻找合法相邻节点合法相邻节点入列标记相邻节点} } 代码 #includeiostream #includevector #includequeue #includeutility using namespace std; int dir[4][2] { 0,1,1,0,-1,0,0,-1 }; void bfs(vectorvectorint a, int x, int y) {queuepairint, int que;que.push({ x,y });a[x][y] 0;while (!que.empty()) {pairint, int cur que.front();que.pop();int curx cur.first;int cury cur.second;for (int i 0; i 4; i) {int nextx curx dir[i][0];int nexty cury dir[i][1];if (nextx 0 || nextx a.size() || nexty 0 || nexty a[0].size()) {continue;}if (a[nextx][nexty] ! 0) {que.push({ nextx,nexty });a[nextx][nexty] 0;}}} } int main() {int m, n;cin m n;vectorvectorint a(m, vectorint(n, 0));for (int i 0; i m; i)for (int j 0; j n; j)cin a[i][j];int result 0;for (int i 0; i m; i) {for (int j 0; j n; j) {if (a[i][j] ! 0) {result;bfs(a, i, j);}}}cout result;return 0; }
http://www.w-s-a.com/news/800538/

相关文章:

  • 门户网站设计特点营销策划咨询机构
  • 天津做网站就到徽信xiala5中国营销型网站
  • 外汇网站建设制作深圳三站合一网站建设
  • 深圳坂田网站设计公司有哪些学校网站建设管理办法
  • 太原建设银行网站中山营销型网站设计
  • 广东省建设厅官方网站多少钱江苏省江建集团有限公司建设网站
  • 网站开发主流服装网站开发课程设计
  • 在iis里面创建网站wordpress响应式视频
  • 学设计哪个网站好网页设计音乐网站
  • 可以自己做斗图的网站上海模板建站多少钱
  • 山东川畅信息技术有限公司网站建设网站开发任务书
  • 网站排版设计欣赏搭建公司介绍网站
  • 网站弹窗是怎么做的长沙智优营家
  • 手机网站菜单设计模板菜单网站图片素材
  • 浙江网站推广爱企查企业查询入口
  • 公司网站平台vs2012网站开发课程设计
  • 哪些方法可以建设网站做网站失败
  • 龙岗网站建设技术wordpress左右两栏
  • 电子商务网站开发与应用的介绍怎么查询域名是否备案
  • 想做一个自己设计公司的网站怎么做的权威发布型舆情回应
  • 做ppt用的音效网站python基础教程网易
  • 可以做免费广告的网站有哪些做视频赚钱的国外网站
  • 苏州做物流网站电话郑州网站高端网站设计
  • 网站建设音乐插件怎么弄wordpress添加数据库文件
  • 汽车行业做网站福建省第二电力建设公司网站
  • delphi做网站开发商城网站建设价位
  • 网站宣传片3 阐述网站建设的步骤过程 9分
  • 公司网站怎么做站外链接哪里有做胎儿dna亲子鉴定
  • 潍坊做电商的网站建设wordpress 特效主题
  • 做网站和app哪个难公司网上注册系统