【算法与数据结构】200、695、LeetCode岛屿数量(深搜+广搜) 岛屿的最大面积

news2024/10/7 3:25:51

文章目录

  • 一、200、岛屿数量
    • 1.1 深度优先搜索DFS
    • 1.2 广度优先搜索BFS
  • 二、695、岛屿的最大面积
    • 2.1 深度优先搜索DFS
    • 2.2 广度优先搜索BFS
  • 三、完整代码

所有的LeetCode题解索引,可以看这篇文章——【算法和数据结构】LeetCode题解。

一、200、岛屿数量

在这里插入图片描述

1.1 深度优先搜索DFS

  思路分析:本题当中1代表的是陆地,0代表海洋,我们需要计算连接在一起的陆地(岛屿)数量,而上下左右这种才算连接在一起,对角线和反对角线上的元素不算。例如下图算三个岛屿:
在这里插入图片描述

  基本思路是遇到一个没有遍历过的陆地,计数器++,然后把该节点陆地连接的陆地全部标记上。遇到标记过的陆地节点和海洋节点全部跳过,最终计数器就是岛屿的数量。因为要标价节点是否遍历过,所以我们创建一个visited布尔数组,false代表未遍历过,true代表遍历过。遍历二维数组采用两个for循环。节点的连接节点遍历通过偏移量数组delta_x_y。终止条件和越界参数处理的if语句相同。

  程序如下

// 200、岛屿数量-深度优先搜索
class Solution {
private:
	int result = 0;
	vector<vector<int>> delta_x_y = { {0, -1}, {0, 1}, {-1, 0}, {1, 0} };	// 上下左右四个方向的偏移量
	void dfs(vector<vector<char>>& grid, vector<vector<bool>>& visited, int x, int y) {	// 1、递归输入参数
		// 3、单层递归逻辑
		for (int i = 0; i < 4; i++) {
			int nextx = x + delta_x_y[i][0];
			int nexty = y + delta_x_y[i][1];
			if (nextx < 0 || nextx >= grid.size() || nexty < 0 || nexty >= grid[0].size()) continue;  // 越界了,直接跳过 2、终止条件
			if (!visited[nextx][nexty] && grid[nextx][nexty] == '1') { // 没有访问过的,同时是陆地的
				visited[nextx][nexty] = true;
				dfs(grid, visited, nextx, nexty);
			}
		}		
	}
public:
    int numIslands(vector<vector<char>>& grid) {
		vector<vector<bool>> visited = vector<vector<bool>>(grid.size(), vector<bool>(grid[0].size(), false));	// 遍历过的坐标
		for (int i = 0; i < grid.size(); i++) {	// 遍历行
			for (int j = 0; j < grid[0].size(); j++) {	// 遍历列
				if (!visited[i][j] && grid[i][j] == '1') {
					visited[i][j] = true;	// 遍历的陆地标记改为true
					result++;		// 遇到没访问过的陆地,岛屿数量++
					dfs(grid, visited, i, j);	// 深度优先搜索,将连接的陆地都标记上true
				}
			}
		}
		return result;
    }
};

复杂度分析:

  • 时间复杂度: O ( m × n ) O(m \times n) O(m×n),其中 m m m n n n分别是岛屿数组的行数和列数。
  • 空间复杂度: O ( m × n ) O(m \times n) O(m×n),主要是栈的调用,最坏情况下,网格全是陆地,深度优先搜索的深度达到 m × n m \times n m×n

1.2 广度优先搜索BFS

  思路分析:广度优先搜索是一圈一圈的搜索过程,而模拟这样的搜索过程可以用队列来实现。每当我们将坐标加入队列时,就代表该左边已经遍历过了,将visited数组标记为true。
  程序如下

// 200、岛屿数量-广度优先搜索
class Solution2 {
private:
	int result = 0;
	vector<vector<int>> delta_x_y = { {0, -1}, {0, 1}, {-1, 0}, {1, 0} };	// 上下左右四个方向的偏移量
	void bfs(vector<vector<char>>& grid, vector<vector<bool>>& visited, int x, int y) {
		queue<pair<int, int>> que; // 定义队列,队列中的元素是对组 pair<int, int>
		que.push({ x, y }); // 起始节点加入队列
		visited[x][y] = true; // 只要加入队列,立刻标记为访问过的节点
		while (!que.empty()) { // 开始遍历队列里的元素
			pair<int, int> cur = que.front(); que.pop(); // 从队列取元素
			int curx = cur.first;
			int cury = cur.second; // 当前节点坐标
			for (int i = 0; i < 4; i++) { // 开始想当前节点的四个方向左右上下去遍历
				int nextx = curx + delta_x_y[i][0]; 
				int nexty = cury + delta_x_y[i][1]; // 获取周边四个方向的坐标
				if (nextx < 0 || nextx >= grid.size() || nexty < 0 || nexty >= grid[0].size()) continue;  // 坐标越界了,直接跳过
				if (!visited[nextx][nexty] && grid[nextx][nexty] == '1') { // 如果节点没被访问过
					que.push({ nextx, nexty });  // 队列添加该节点为下一轮要遍历的节点
					visited[nextx][nexty] = true; // 只要加入队列立刻标记,避免重复访问
				}
			}
		}
	}
public:
	int numIslands(vector<vector<char>>& grid) {
		vector<vector<bool>> visited = vector<vector<bool>>(grid.size(), vector<bool>(grid[0].size(), false));	// 遍历过的坐标
		for (int i = 0; i < grid.size(); i++) {	// 遍历行
			for (int j = 0; j < grid[0].size(); j++) {	// 遍历列
				if (!visited[i][j] && grid[i][j] == '1') {
					visited[i][j] = true;	// 遍历的陆地标记改为true
					result++;		// 遇到没访问过的陆地,岛屿数量++
					bfs(grid, visited, i, j);	// 深度优先搜索,将连接的陆地都标记上true
				}
			}
		}
		return result;
	}
};

复杂度分析:

  • 时间复杂度: O ( m × n ) O(m \times n) O(m×n),其中 m m m n n n分别是岛屿数组的行数和列数。
  • 空间复杂度: O ( m i n ( m , n ) ) O(min(m, n)) O(min(m,n)),在最坏情况下,整个网格均为陆地,队列的大小可以达到 m i n ( m , n ) min(m, n) min(m,n)

二、695、岛屿的最大面积

在这里插入图片描述

2.1 深度优先搜索DFS

  思路分析:在200题岛屿数量的基础之上,题目要求我们求岛屿的最大面积,单块陆地的面积为1。思路很简单,每次遍历之后面积计数器++,然后在不同陆地的面积之中取最大值。
  程序如下

// 695、岛屿的最大面积-深度优先搜索
class Solution3 {
private:
	int maxArea = 0;
	int Area = 0;
	vector<vector<int>> delta_x_y = { {0, -1}, {0, 1}, {-1, 0}, {1, 0} };	// 上下左右四个方向的偏移量
	void dfs(vector<vector<int>>& grid, vector<vector<bool>>& visited, int x, int y) {	// 1、递归输入参数
		// 2、终止条件 访问过或者遇到海水
		if (visited[x][y] || grid[x][y] == 0) return;	
		visited[x][y] = true;
		Area++;
		// 3、单层递归逻辑
		for (int i = 0; i < 4; i++) {
			int nextx = x + delta_x_y[i][0];
			int nexty = y + delta_x_y[i][1];
			if (nextx < 0 || nextx >= grid.size() || nexty < 0 || nexty >= grid[0].size()) continue;  // 越界了,直接跳过 
			dfs(grid, visited, nextx, nexty);
		}
	}
public:
	int maxAreaOfIsland(vector<vector<int>>& grid) {
		vector<vector<bool>> visited = vector<vector<bool>>(grid.size(), vector<bool>(grid[0].size(), false));	// 遍历过的坐标
		for (int i = 0; i < grid.size(); i++) {	// 遍历行
			for (int j = 0; j < grid[0].size(); j++) {	// 遍历列
				if (!visited[i][j] && grid[i][j] == 1) {
					Area = 0;
					dfs(grid, visited, i, j);	// 深度优先搜索,将连接的陆地都标记上true
					maxArea = max(Area, maxArea);					
				}
			}
		}
		return maxArea;
	}
};
  • 时间复杂度: O ( m × n ) O(m \times n) O(m×n),其中 m m m n n n分别是岛屿数组的行数和列数。
  • 空间复杂度: O ( m × n ) O(m \times n) O(m×n),主要是栈的调用,最坏情况下,网格全是陆地,深度优先搜索的深度达到 m × n m \times n m×n

2.2 广度优先搜索BFS

  思路分析:思路和深度优先搜索一样。
  程序如下

// 695、岛屿的最大面积-广度优先搜索
class Solution4 {
private:
	int maxArea = 0;
	int Area = 0;
	vector<vector<int>> delta_x_y = { {0, -1}, {0, 1}, {-1, 0}, {1, 0} };	// 上下左右四个方向的偏移量
	void bfs(vector<vector<int>>& grid, vector<vector<bool>>& visited, int x, int y) {
		queue<pair<int, int>> que; // 定义队列,队列中的元素是对组 pair<int, int>
		que.push({ x, y }); // 起始节点加入队列
		visited[x][y] = true; // 只要加入队列,立刻标记为访问过的节点
		Area++;
		while (!que.empty()) { // 开始遍历队列里的元素
			pair<int, int> cur = que.front(); que.pop(); // 从队列取元素
			int curx = cur.first;
			int cury = cur.second; // 当前节点坐标
			for (int i = 0; i < 4; i++) { // 开始想当前节点的四个方向左右上下去遍历
				int nextx = curx + delta_x_y[i][0];
				int nexty = cury + delta_x_y[i][1]; // 获取周边四个方向的坐标
				if (nextx < 0 || nextx >= grid.size() || nexty < 0 || nexty >= grid[0].size()) continue;  // 坐标越界了,直接跳过
				if (!visited[nextx][nexty] && grid[nextx][nexty] == 1) { // 如果节点没被访问过
					que.push({ nextx, nexty });  // 队列添加该节点为下一轮要遍历的节点
					visited[nextx][nexty] = true; // 只要加入队列立刻标记,避免重复访问
					Area++;
				}
			}
		}
	}
public:
	int maxAreaOfIsland(vector<vector<int>>& grid) {
		vector<vector<bool>> visited = vector<vector<bool>>(grid.size(), vector<bool>(grid[0].size(), false));	// 遍历过的坐标
		for (int i = 0; i < grid.size(); i++) {	// 遍历行
			for (int j = 0; j < grid[0].size(); j++) {	// 遍历列
				if (!visited[i][j] && grid[i][j] == 1) {
					Area = 0;
					bfs(grid, visited, i, j);	// 深度优先搜索,将连接的陆地都标记上true
					maxArea = max(Area, maxArea);
				}
			}
		}
		return maxArea;
	}
};

复杂度分析:

  • 时间复杂度: O ( m × n ) O(m \times n) O(m×n),其中 m m m n n n分别是岛屿数组的行数和列数。
  • 空间复杂度: O ( m i n ( m , n ) ) O(min(m, n)) O(min(m,n)),在最坏情况下,整个网格均为陆地,队列的大小可以达到 m i n ( m , n ) min(m, n) min(m,n)

三、完整代码

# include <iostream>
# include <vector>
# include <queue>
using namespace std;

// 200、岛屿数量-深度优先搜索
class Solution {
private:
	int result = 0;
	vector<vector<int>> delta_x_y = { {0, -1}, {0, 1}, {-1, 0}, {1, 0} };	// 上下左右四个方向的偏移量
	void dfs(vector<vector<char>>& grid, vector<vector<bool>>& visited, int x, int y) {	// 1、递归输入参数
		// 3、单层递归逻辑
		for (int i = 0; i < 4; i++) {
			int nextx = x + delta_x_y[i][0];
			int nexty = y + delta_x_y[i][1];
			if (nextx < 0 || nextx >= grid.size() || nexty < 0 || nexty >= grid[0].size()) continue;  // 越界了,直接跳过 2、终止条件
			if (!visited[nextx][nexty] && grid[nextx][nexty] == '1') { // 没有访问过的,同时是陆地的
				visited[nextx][nexty] = true;
				dfs(grid, visited, nextx, nexty);
			}
		}		
	}
public:
    int numIslands(vector<vector<char>>& grid) {
		vector<vector<bool>> visited = vector<vector<bool>>(grid.size(), vector<bool>(grid[0].size(), false));	// 遍历过的坐标
		for (int i = 0; i < grid.size(); i++) {	// 遍历行
			for (int j = 0; j < grid[0].size(); j++) {	// 遍历列
				if (!visited[i][j] && grid[i][j] == '1') {
					visited[i][j] = true;	// 遍历的陆地标记改为true
					result++;		// 遇到没访问过的陆地,岛屿数量++
					dfs(grid, visited, i, j);	// 深度优先搜索,将连接的陆地都标记上true
				}
			}
		}
		return result;
    }
};

// 200、岛屿数量-广度优先搜索
class Solution2 {
private:
	int result = 0;
	vector<vector<int>> delta_x_y = { {0, -1}, {0, 1}, {-1, 0}, {1, 0} };	// 上下左右四个方向的偏移量
	void bfs(vector<vector<char>>& grid, vector<vector<bool>>& visited, int x, int y) {
		queue<pair<int, int>> que; // 定义队列,队列中的元素是对组 pair<int, int>
		que.push({ x, y }); // 起始节点加入队列
		visited[x][y] = true; // 只要加入队列,立刻标记为访问过的节点
		while (!que.empty()) { // 开始遍历队列里的元素
			pair<int, int> cur = que.front(); que.pop(); // 从队列取元素
			int curx = cur.first;
			int cury = cur.second; // 当前节点坐标
			for (int i = 0; i < 4; i++) { // 开始想当前节点的四个方向左右上下去遍历
				int nextx = curx + delta_x_y[i][0]; 
				int nexty = cury + delta_x_y[i][1]; // 获取周边四个方向的坐标
				if (nextx < 0 || nextx >= grid.size() || nexty < 0 || nexty >= grid[0].size()) continue;  // 坐标越界了,直接跳过
				if (!visited[nextx][nexty] && grid[nextx][nexty] == '1') { // 如果节点没被访问过
					que.push({ nextx, nexty });  // 队列添加该节点为下一轮要遍历的节点
					visited[nextx][nexty] = true; // 只要加入队列立刻标记,避免重复访问
				}
			}
		}
	}
public:
	int numIslands(vector<vector<char>>& grid) {
		vector<vector<bool>> visited = vector<vector<bool>>(grid.size(), vector<bool>(grid[0].size(), false));	// 遍历过的坐标
		for (int i = 0; i < grid.size(); i++) {	// 遍历行
			for (int j = 0; j < grid[0].size(); j++) {	// 遍历列
				if (!visited[i][j] && grid[i][j] == '1') {
					visited[i][j] = true;	// 遍历的陆地标记改为true
					result++;		// 遇到没访问过的陆地,岛屿数量++
					bfs(grid, visited, i, j);	// 深度优先搜索,将连接的陆地都标记上true
				}
			}
		}
		return result;
	}
};

// 695、岛屿的最大面积-深度优先搜索
class Solution3 {
private:
	int maxArea = 0;
	int Area = 0;
	vector<vector<int>> delta_x_y = { {0, -1}, {0, 1}, {-1, 0}, {1, 0} };	// 上下左右四个方向的偏移量
	void dfs(vector<vector<int>>& grid, vector<vector<bool>>& visited, int x, int y) {	// 1、递归输入参数
		// 2、终止条件 访问过或者遇到海水
		if (visited[x][y] || grid[x][y] == 0) return;	
		visited[x][y] = true;
		Area++;
		// 3、单层递归逻辑
		for (int i = 0; i < 4; i++) {
			int nextx = x + delta_x_y[i][0];
			int nexty = y + delta_x_y[i][1];
			if (nextx < 0 || nextx >= grid.size() || nexty < 0 || nexty >= grid[0].size()) continue;  // 越界了,直接跳过 
			dfs(grid, visited, nextx, nexty);
		}
	}
public:
	int maxAreaOfIsland(vector<vector<int>>& grid) {
		vector<vector<bool>> visited = vector<vector<bool>>(grid.size(), vector<bool>(grid[0].size(), false));	// 遍历过的坐标
		for (int i = 0; i < grid.size(); i++) {	// 遍历行
			for (int j = 0; j < grid[0].size(); j++) {	// 遍历列
				if (!visited[i][j] && grid[i][j] == 1) {
					Area = 0;
					dfs(grid, visited, i, j);	// 深度优先搜索,将连接的陆地都标记上true
					maxArea = max(Area, maxArea);					
				}
			}
		}
		return maxArea;
	}
};

// 695、岛屿的最大面积-广度优先搜索
class Solution4 {
private:
	int maxArea = 0;
	int Area = 0;
	vector<vector<int>> delta_x_y = { {0, -1}, {0, 1}, {-1, 0}, {1, 0} };	// 上下左右四个方向的偏移量
	void bfs(vector<vector<int>>& grid, vector<vector<bool>>& visited, int x, int y) {
		queue<pair<int, int>> que; // 定义队列,队列中的元素是对组 pair<int, int>
		que.push({ x, y }); // 起始节点加入队列
		visited[x][y] = true; // 只要加入队列,立刻标记为访问过的节点
		Area++;
		while (!que.empty()) { // 开始遍历队列里的元素
			pair<int, int> cur = que.front(); que.pop(); // 从队列取元素
			int curx = cur.first;
			int cury = cur.second; // 当前节点坐标
			for (int i = 0; i < 4; i++) { // 开始想当前节点的四个方向左右上下去遍历
				int nextx = curx + delta_x_y[i][0];
				int nexty = cury + delta_x_y[i][1]; // 获取周边四个方向的坐标
				if (nextx < 0 || nextx >= grid.size() || nexty < 0 || nexty >= grid[0].size()) continue;  // 坐标越界了,直接跳过
				if (!visited[nextx][nexty] && grid[nextx][nexty] == 1) { // 如果节点没被访问过
					que.push({ nextx, nexty });  // 队列添加该节点为下一轮要遍历的节点
					visited[nextx][nexty] = true; // 只要加入队列立刻标记,避免重复访问
					Area++;
				}
			}
		}
	}
public:
	int maxAreaOfIsland(vector<vector<int>>& grid) {
		vector<vector<bool>> visited = vector<vector<bool>>(grid.size(), vector<bool>(grid[0].size(), false));	// 遍历过的坐标
		for (int i = 0; i < grid.size(); i++) {	// 遍历行
			for (int j = 0; j < grid[0].size(); j++) {	// 遍历列
				if (!visited[i][j] && grid[i][j] == 1) {
					Area = 0;
					bfs(grid, visited, i, j);	// 深度优先搜索,将连接的陆地都标记上true
					maxArea = max(Area, maxArea);
				}
			}
		}
		return maxArea;
	}
};

int main() {
	// // 200、岛屿数量测试案例
	//vector<vector<char>> grid = { {'1', '1', '1', '1', '0'} ,{'1', '1', '0', '1', '0'}, {'1', '1', '0', '0', '0'}, {'0', '0', '0', '0', '0'} };	
	//Solution s1;
	//int result = s1.numIslands(grid);

	// 695、岛屿的最大面积测试案例
	vector<vector<int>> grid = { {0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0 }, { 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0 }, { 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 } };
	Solution4 s1;
	int result = s1.maxAreaOfIsland(grid);

	cout << result << endl;
	system("pause");
	return 0;
}

end

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1462680.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

C#算法(12)—对图像像素做X/Y方向的偏移

我们在上位机开发领域有时候需要对获取的图像的像素做整体的偏移,比如所有像素在X方向上偏移几个像素,或者所有像素在Y方向上偏移几个像素,本文就是开发了像素整体偏移算法来解决这个问题。 比如有一个图像大小为3*3,像素值如下图1,如果我想实现将这个幅图像的像素整体往右…

[ Python+OpenCV+Mediapipe ] 实现对象识别

一、写在前面 本文所用例子为个人学习的小结&#xff0c;如有不足之处请各位多多海涵&#xff0c;欢迎小伙伴一起学习进步&#xff0c;如果想法可在评论区指出&#xff0c;我会尽快回复您&#xff0c;不胜感激&#xff01; 所公布代码或截图均为运行成功后展示。 二、本文内容…

计网 - 域名解析的工作流程

文章目录 Pre引言1. DNS是什么2. 域名结构3. 域名解析的工作流程4. 常见的DNS记录类型5. DNS安全6. 未来的发展趋势 Pre 计网 - DNS 域名解析系统 引言 在我们日常使用互联网时&#xff0c;经常会输入各种域名来访问网站、发送电子邮件或连接其他网络服务。然而&#xff0c;我…

构建React TodoList应用:管理你的任务清单

构建React TodoList应用&#xff1a;管理你的任务清单 在日常生活和工作中&#xff0c;任务管理是一项至关重要的任务。为了更好地组织和管理我们的工作和生活&#xff0c;我们需要一个高效而简单的任务管理工具。本文将介绍如何使用React框架构建一个功能丰富的TodoList应用&…

C++动态分配内存知识点!

个人主页&#xff1a;PingdiGuo_guo 收录专栏&#xff1a;C干货专栏 大家好呀&#xff0c;又是分享干货的时间&#xff0c;今天我们来学习一下动态分配内存。 文章目录 1.动态分配内存的思想 2.动态分配内存的概念 2.1内存分配函数 2.2动态内存的申请和释放 2.3内存碎片问…

新手学习Cesium的几点建议

Cesium是当前非常火热的三维数字地球开发框架&#xff0c;很多公司基于Cesium做项目以及形成了自己的产品&#xff0c;关于Cesium的学习&#xff0c;有诸多网站、书籍、学习资料甚至培训教材&#xff0c;这里不再详细推荐&#xff0c;从学习Cesium的角度&#xff0c;资料和教程…

web开发中的长度单位详解

1、长度单位包括哪些&#xff1f; 长度单位&#xff1a;例如&#xff0c;厘米、毫米、英寸。还有像素&#xff08;px&#xff09;&#xff0c;元素的字体高度&#xff08;em&#xff09;、字母x的高度&#xff08;ex&#xff09;、百分比&#xff08;%&#xff09;等这些单位&…

[ 2024春节 Flink打卡 ] -- Paimon

2024&#xff0c;游子未归乡。工作需要&#xff0c;flink coding。觉知此事要躬行&#xff0c;未休&#xff0c;特记 Flink 社区希望能够将 Flink 的 Streaming 实时计算能力和 Lakehouse 新架构优势进一步结合&#xff0c;推出新一代的 Streaming Lakehouse 技术&#xff0c;…

MySQL加锁策略详解

我们主要从三个方面来讨论这个问题&#xff1a; 啥时候加&#xff1f;如何加&#xff1f;什么时候该加什么时候不该加&#xff1f; 1、啥时候加 1.1 显式锁 MySQL 的加锁可以分为显式加锁和隐式加锁&#xff0c;显式加锁我们比较好识别的&#xff0c;因为他往往直接体现在 S…

25-k8s集群中-RBAC用户角色资源权限

一、RBAC概述 1&#xff0c;k8s集群的交互逻辑&#xff08;简单了解&#xff09; 我们通过k8s各组件架构&#xff0c;指导各个组件之间是使用https进行数据加密及交互的&#xff0c;那么同理&#xff0c;我们作为“使用”k8s的各种资源&#xff0c;也是通过https进行数据加密的…

4 编写达梦插件包

1、初始化达梦数据库 具体脚本可以参考: https://github.com/nacos-group/nacos-plugin/blob/develop/nacos-datasource-plugin-ext/nacos-dm-datasource-plugin-ext/src/main/resources/schema/nacos-dm.sql

国际阿里云,想要使用怎么解决支付问题

在国内我们很多时候都需要用到国际阿里云&#xff0c;在国际阿里云需要使用就需要支付&#xff0c;自己办理visa卡比较麻烦&#xff0c;那么我们可以使用虚拟卡&#xff0c;虚拟卡办理快速简单 真实测评使用Fomepay的5347支持国际阿里云的支付&#xff0c;秒下卡&#xff0c;不…

Talk|北京大学杨灵:扩散模型的算法创新与领域应用

本期为TechBeat人工智能社区第572期线上Talk。 北京时间2月21日(周三)20:00&#xff0c;北京大学博士生—杨灵的Talk已准时在TechBeat人工智能社区开播&#xff01; 他与大家分享的主题是: “扩散模型的算法创新与领域应用”&#xff0c;系统地介绍了他的团队基于扩散模型的算法…

vue3在router跳转路由时,params失效问题

vue-router重要提示。 解决方案&#xff1a; 1. 使用query传参 但是变量会直接暴露在url中 2.用store或localStorage这种办法暂存一下。

书生·浦语大模型实战营第二节课作业

使用 InternLM-Chat-7B 模型生成 300 字的小故事&#xff08;基础作业1&#xff09;。 熟悉 hugging face 下载功能&#xff0c;使用 huggingface_hub python 包&#xff0c;下载 InternLM-20B 的 config.json 文件到本地&#xff08;基础作业2&#xff09;。 下载过程 进阶…

Vue+SpringBoot打造校园二手交易系统

目录 一、摘要1.1 项目介绍1.2 项目录屏 二、功能模块2.1 数据中心模块2.2 二手商品档案管理模块2.3 商品预约管理模块2.4 商品预定管理模块2.5 商品留言板管理模块2.6 商品资讯管理模块 三、实体类设计3.1 用户表3.2 二手商品表3.3 商品预约表3.4 商品预定表3.5 留言表3.6 资讯…

蓝桥杯备赛系列——倒计时50天!

蓝桥杯备赛系列 倒计时50天&#xff01; 前缀和和差分 知识点 **前缀和数组&#xff1a;**假设原数组用a[i]表示&#xff0c;前缀和数组用sum[i]表示&#xff0c;那么sum[i]表示的是原数组前i项之和&#xff0c;注意一般用前缀和数组时&#xff0c;原数组a[i]的有效下标是从…

PotPlayer+Alist挂载并播放网盘视频

文章目录 说明技术WebDAVPotPlayer 操作步骤一&#xff1a;Alist开启WebDAV代理二&#xff1a;PotPlayer连接Alist 说明 Alist网页端播放视频受限&#xff0c;主要是文件大于20MB&#xff0c;由于官方限制&#xff0c;无法播放需要使用user-agent修改插件&#xff0c;设置百度…

ES项目应用

配置: ES存储了2-3亿条&#xff0c;几百GB ES集群有5 个节点 2主2副 ES返回数据量窗口大小设置 index.max_result_window 深度翻页 1.from size 方式 2.scroll相当于维护了一份当前索引段的快照信息&#xff0c;这个快照信息是你执行这个scroll查询时的快照。在这个查询后的任…

【selenium】八大元素定位方式|xpath css id name...

目录 一、基础元素定位 二、cssSelector元素定位——通过元素属性定位 三、xpath元素定位——通过路径 1 、xpath绝对定位 &#xff08;用的不多&#xff09; 缺点&#xff1a;一旦页面结构发生变化&#xff08;比如重新设计时&#xff0c;路径少两节&#xff09;&#x…