上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 32 下一页
摘要: 基本思想: 感觉以后要注意一下,最小生成树里面有几个坑: 1.自环问题; 2.两节点间拥有多重路径; 关键点: Prim基础版本无需考虑自环问题; #include<iostream> #include<stdlib.h> #include<vector> #include<string> usin 阅读全文
posted @ 2020-03-30 13:01 暮云林凌 阅读(124) 评论(0) 推荐(0)
摘要: 基本思想: 本质上是利用一次稠密图Prim算法解决,不难; 关键点: 无; #include<iostream> #include<vector> #include<string> #include<algorithm> #include<cmath> using namespace std; co 阅读全文
posted @ 2020-03-28 21:53 暮云林凌 阅读(160) 评论(0) 推荐(0)
摘要: 最小生成树问题可以算是最短路径的升级版; 先注意一下两者的区别: 最短路径针对的是单源最短问题; 最小生成树针对的是全局最短问题,最短路径貌似可以解决最小生成树问题,但是并不能保证全局路径最短; 针对于最小生成树问题,总的来说有两种解决办法:prim算法和Kruskal算法; 对于这两种算法,针对的 阅读全文
posted @ 2020-03-28 20:55 暮云林凌 阅读(389) 评论(0) 推荐(0)
摘要: 基本思想: 迪杰斯特拉得翻版,循环求各个节点,最后求最小结果; 关键点: 注意题目要求; #include<iostream> #include<vector> #include<string> #include<algorithm> using namespace std; const int m 阅读全文
posted @ 2020-03-26 18:28 暮云林凌 阅读(136) 评论(0) 推荐(0)
摘要: 基本思想: 使用迭代会很麻烦,还不如递归进行字符串拼接; 关键点: 无; #include<iostream> #include<vector> #include<string> #include<algorithm> using namespace std; const int maxn = 15 阅读全文
posted @ 2020-03-14 17:58 暮云林凌 阅读(168) 评论(0) 推荐(0)
摘要: 基本思想: 无; 关键点: 无; #include<iostream> #include<vector> #include<string> using namespace std; bool vis[26]; void charge(string s,int cnt) { if (cnt == 0) 阅读全文
posted @ 2020-03-14 02:10 暮云林凌 阅读(151) 评论(0) 推荐(0)
摘要: 基本思想: 无; 关键点: 无; #include<iostream> #include<vector> using namespace std; int main() { int n; while (cin >> n) { vector<int>vec; vec.push_back(1); vec 阅读全文
posted @ 2020-03-14 01:50 暮云林凌 阅读(207) 评论(0) 推荐(0)
摘要: 基本思想: 无; 关键点: 无; #include<iostream> #include<algorithm> #include<string> #include<stdio.h> #include<vector> using namespace std; bool flag; struct nod 阅读全文
posted @ 2020-03-14 01:29 暮云林凌 阅读(130) 评论(0) 推荐(0)
摘要: 基本思想: 自己想复杂了,把要给人选多门课给包含进去了; 关键点: 无; #include<iostream> #include<algorithm> #include<string> #include<vector> using namespace std; const int maxn = 21 阅读全文
posted @ 2020-03-14 01:20 暮云林凌 阅读(182) 评论(0) 推荐(0)
摘要: 基本思想: 其实用二叉树更简单一点,但是个人认为题目有可能不太严谨,会出现多棵树情况,用二叉树一样的还是要判断节点是否在一棵树上,没啥必要; 关键点: 无; #include<iostream> #include<string> #include<vector> #include<algorithm 阅读全文
posted @ 2020-03-14 00:53 暮云林凌 阅读(129) 评论(0) 推荐(0)
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 32 下一页