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

购物网站模板免费新公司做网站怎么做

购物网站模板免费,新公司做网站怎么做,网络推广策划思路,防网站模板今日任务 99. 岛屿数量 深度搜搜 99. 岛屿数量 广度搜索 100. 岛屿的最大面积 99. 岛屿数量 题目链接#xff1a; 99. 岛屿数量 import java.util.Scanner;public class Main {public static int[][] dir {{0, 1},{1, 0},{-1, 0},{0, -1}};public static void dfs(boolean… 今日任务 99. 岛屿数量 深度搜搜 99. 岛屿数量 广度搜索 100. 岛屿的最大面积 99. 岛屿数量 题目链接 99. 岛屿数量 import java.util.Scanner;public class Main {public static int[][] dir {{0, 1},{1, 0},{-1, 0},{0, -1}};public static void dfs(boolean[][] visited, int x, int y, int[][] grid) {for (int i 0; i 4; i) {int nextX x dir[i][0];int nextY y dir[i][1];if (nextX 0 || nextY 0 || nextX grid.length || nextY grid[0].length) {continue;}if (!visited[nextX][nextY] grid[nextX][nextY] 1) {visited[nextX][nextY] true;dfs(visited, nextX, nextY, grid);}}}public static void main(String[] args) {Scanner scanner new Scanner(System.in);int m scanner.nextInt();int n scanner.nextInt();int[][] grid new int[m][n];for (int i 0; i m; i) {for (int j 0; j n; j) {grid[i][j] scanner.nextInt();}}boolean[][] visited new boolean[m][n];int res 0;for (int i 0; i m; i) {for (int j 0; j n; j) {if (!visited[i][j] grid[i][j] 1) {res;visited[i][j] true;dfs(visited, i, j, grid);}}}System.out.println(res);}} 99. 岛屿数量 题目链接 99. 岛屿数量 import java.util.Scanner; import java.util.*;public class Main {public static int[][] dir {{0, 1},{1, 0},{-1, 0},{0, -1}};public static void bfs(boolean[][] visited, int x, int y, int[][] grid){Queueint[] queue new LinkedList();queue.add(new int[]{x, y});visited[x][y] true;while (!queue.isEmpty()) {int curX queue.peek()[0];int curY queue.peek()[1];queue.poll();for (int i 0; i 4; i) {int nextX curX dir[i][0];int nextY curY dir[i][1];if (nextX 0 || nextY 0 || nextX grid.length || nextY grid[0].length) {continue;}if (!visited[nextX][nextY] grid[nextX][nextY] 1) {queue.add(new int[]{nextX, nextY});visited[nextX][nextY] true;}}}}public static void main(String[] args) {Scanner scanner new Scanner(System.in);int m scanner.nextInt();int n scanner.nextInt();int[][] grid new int[m][n];for (int i 0; i m; i) {for (int j 0; j n; j) {grid[i][j] scanner.nextInt();}}int res 0;boolean[][] visited new boolean[m][n];for (int i 0; i m; i) {for (int j 0; j n; j) {if (!visited[i][j] grid[i][j] 1) {res;bfs(visited, i, j, grid);}}}System.out.println(res);}} 100. 岛屿的最大面积 题目链接 100. 岛屿的最大面积 import java.util.*; public class Main {public static int[][] dir {{0, 1},{1, 0},{-1, 0},{0, -1}};public static int res 0;public static void bfs(boolean[][] visited, int x, int y, int[][] grid){Queueint[] queue new LinkedList();queue.add(new int[]{x, y});visited[x][y] true;while (!queue.isEmpty()) {int curX queue.peek()[0];int curY queue.peek()[1];queue.poll();for (int i 0; i 4; i) {int nextX curX dir[i][0];int nextY curY dir[i][1];if (nextX 0 || nextY 0 || nextX grid.length || nextY grid[0].length) {continue;}if (!visited[nextX][nextY] grid[nextX][nextY] 1) {res;queue.add(new int[]{nextX, nextY});visited[nextX][nextY] true;}}}}public static void main(String[] args){Scanner scanner new Scanner(System.in);int m scanner.nextInt();int n scanner.nextInt();int[][] grid new int[m][n];for (int i 0; i m; i) {for (int j 0; j n; j) {grid[i][j] scanner.nextInt();}}int max 0;boolean[][] visited new boolean[grid.length][grid[0].length];for (int i 0; i grid.length; i) {for (int j 0; j grid[0].length; j) {if (!visited[i][j] grid[i][j] 1) {res 1;visited[i][j] true;bfs(visited, i, j, grid);}max Math.max(max, res);}}System.out.println(max);} }
http://www.dnsts.com.cn/news/41316.html

相关文章:

  • 网站开发合同范本大全免费搭建网站平台
  • 做教育机构网站免费网站建设方案优化
  • 二手车网站源码百度指数官网
  • php网站开发入门谷歌怎么做网站推广
  • 广州 做网站上海十大it外包公司
  • 电龙网站建设网页设计的规格
  • 小程序有做门户网站莆田软件定制开发
  • 信誉好的盐城网站开发多余菜单删掉wordpress
  • 做网站的实践报告哪些网站做外贸效果好
  • 网站有什么组成怎么做网站门户
  • 建个人网站怎么赚钱网站合同建设模板
  • 网站的建设与管理系统北丰科技网站建设
  • 网页版是什么意思seo教程排名第一
  • 企业网站明细费用揭阳模板网站建站
  • 网站开发所需人才wordpress 页面设置
  • cdn能为网站上wordpress流程
  • 京东网站注册国内外网站开发技术有哪些
  • 移动互联和网站开发哪个好重庆装修公司排行榜
  • 1G免费网站空间个体工商户营业执照年检
  • 网站为什么功能需求制作网站背景怎么做
  • 杭州网站模板外贸工艺品网站建设
  • 网站建设首选原创先锋企业管理平台app
  • 做网站 提要求国内优秀设计网站站长
  • 如何使用网站模板建设网站外贸做的亚马逊网站是哪个
  • 网站的作用和意义网站建设长沙
  • 分类信息网站推广的意义学校网站建设流程步骤
  • 做app网站公司名称管理信息系统与网站建设有什么区别
  • 刘涛做代言的那个网站网站设计需要多少钱
  • 2021中文字幕入口网站大学校园网络设计方案
  • 定制型网站设计有全部公司的网站