勤劳的小蜗牛许愿简历通过
勤劳的小蜗牛许愿简历通过
全部文章
分类
归档
标签
去牛客网
登录
/
注册
勤劳的小蜗牛许愿简历通过的博客
全部文章
(共83篇)
题解 | #kotori和素因子#
#include<iostream>#include<set>using namespace std;int n;int a[1010];int INF = 1e8;int sum;bool primer(int x){ for(int i = 2; i * i <...
2024-10-25
0
47
题解 | #岛屿数量#
#include <vector> class Solution { public: void dfs(vector<vector<char>>& grid, int i, int j){ int n = grid.size();...
2024-10-25
0
53
题解 | #走迷宫#
#include <iostream> #include<queue> #include<cstring> #include<algorithm> using namespace std; typedef pair<int, int> PI...
2024-10-25
0
51
题解 | #【模板】堆#
#include<algorithm> #include<iostream> using namespace std; const int N = 100010; int siz, h[N]; void up(int u){ while(u > 1 &...
2024-10-24
0
33
题解 | #从中序与后序遍历序列构造二叉树#
// 通过后序遍历序列可以确定树的根节点,然后利用中序遍历将树分为左子树和右子树,递归地构建整棵树 #include <unordered_map> #include <vector> class Solution { public: TreeNode* TreeHe...
2024-10-24
0
69
题解 | #实现二叉树先序,中序和后序遍历#
/** * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {...
2024-10-24
0
39
题解 | #【模板】单源最短路2#
要考虑到案例2的情况。循环要到N #include<iostream> #include<cstring> using namespace std; const int N = 5100; int n, m; int g[N][N]; int dist[N]; bool s...
2024-10-24
0
48
题解 | #最小生成树#
#include <vector> class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 返回最小的花费代价使得这n户人家连接起来 * @param ...
2024-10-24
0
30
题解 | #【模板】拓扑排序#
#include <cstring> #include <iostream> using namespace std; const int N = 200010; int h[N], idx, e[N], ne[N]; int q[N], d[N]; int n, m; v...
2024-10-23
0
39
题解 | #删除链表的节点#
/** * struct ListNode { * int val; * struct ListNode *next; * ListNode(int x) : val(x), next(nullptr) {} * }; */ class Solution { public: /*...
2024-10-23
0
35
首页
上一页
1
2
3
4
5
6
7
8
9
下一页
末页