上一页 1 ··· 4 5 6 7 8 9 10 11 12 下一页
摘要: 注:弗洛伊德算法也可以在数据范围很小时($10^2$级别)求单源最短路,例如3488.最短路径。优点是弗洛伊德算法相对于Dijkstra更好写,就三个for循环,代码比较短,缺点是只有在数据范围是$10^2$级别才能用。 3488. 最短路径 #include <iostream> #include 阅读全文
posted @ 2023-04-12 17:40 Tshaxz 阅读(27) 评论(0) 推荐(0)
摘要: 超级(虚拟)源点类型 1488. 最短距离(超级源点) 建立超级源点,从超级源点向某些点连一条权值为0的单向边 #include <iostream> #include <algorithm> #include <cstring> #include <queue> using namespace s 阅读全文
posted @ 2023-04-12 17:33 Tshaxz 阅读(23) 评论(0) 推荐(0)
摘要: 207. 课程表 const int N = 100010, M = 5010; class Solution { public: int h[N], e[M], ne[M], idx = 0; int in[N], q[N]; void add(int a, int b) { e[idx] = b 阅读全文
posted @ 2023-04-12 17:04 Tshaxz 阅读(23) 评论(0) 推荐(0)
摘要: 计算B进制的值(秦九韶算法) 4945. 比大小 #include <iostream> #include <cstring> using namespace std; typedef long long LL; LL get() { LL res = 0; int n, b; cin >> n > 阅读全文
posted @ 2023-04-03 10:48 Tshaxz 阅读(24) 评论(0) 推荐(0)
摘要: #include <iostream> using namespace std; void bin(int n) { int res = 0; for (int i = 3; i >= 0; i -- ) cout << (n >> i & 1); } long fun_a(unsigned lon 阅读全文
posted @ 2022-12-08 17:56 Tshaxz 阅读(113) 评论(0) 推荐(0)
摘要: 有理数:指所有可以用两个整数的商来表示的数 Rational.h Rational类的接口 #ifndef _RATIONAL_H #define _RATIONAL_H #include <iostream> #include <string> class Rational { public: R 阅读全文
posted @ 2022-10-06 22:05 Tshaxz 阅读(85) 评论(0) 推荐(0)
摘要: 学习资料 1.算法讲解058【必备】洪水填充 2.B10 DFS 水坑计数 1.求网格图中连通块的数目 P1596 [USACO10OCT] Lake Counting S 八连通坐标写法如下: DFS写法 #include <iostream> using namespace std; const 阅读全文
posted @ 2022-09-23 20:02 Tshaxz 阅读(26) 评论(0) 推荐(0)
摘要: 快速排序 912. 排序数组 class Solution { public: void quick_sort(vector<int>& q, int l, int r) { if(l >= r) return; int i = l - 1, j = r + 1, x = q[l + r >> 1] 阅读全文
posted @ 2022-09-06 18:48 Tshaxz 阅读(21) 评论(0) 推荐(0)
摘要: 求解方法: 二叉树的最近公共祖先(Lowest Common Ancestor) 北邮考研机试题 求两结点之间的最短路径长度 视频讲解 #include <iostream> #include <algorithm> #include <cstring> using namespace std; c 阅读全文
posted @ 2022-09-05 11:22 Tshaxz 阅读(24) 评论(0) 推荐(0)
摘要: 因为8版本之后的LeetCode Editor都只支持2020之后的Clion,好在作者又更新了一个早期的LeetCode Editor https://github.com/shuzijun/leetcode-editor/releases/tag/v6.11 下载好之后导入本地插件即可,选择刚刚 阅读全文
posted @ 2022-09-04 22:21 Tshaxz 阅读(813) 评论(0) 推荐(0)
上一页 1 ··· 4 5 6 7 8 9 10 11 12 下一页
Language: HTML