摘要: 3348. 树的双亲存储法 ECNU-3348 /** * 这里不能用邻接矩阵的形式存储整个图,因为可能会出现重边的问题。 * 如果是简单的重边,取最短边即可,但是本题需要求出所有的最短路径,所以更长的边 * 对结果会有影响 */ #include<iostream> #include<cstdio 阅读全文
posted @ 2020-10-07 17:10 Garrett_Wale 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 最短路径2 ECNU-1818 本题需要注意的一个问题就是重边的问题,虽然这题的数据量很小,但是不能使用邻接矩阵来存储,也不能将重边记为最小边来计算。 这里求最短路径的条数有很多方法,我第一个想到的是使用dfs来遍历,但是会超时。 有一个简单的记录最短路径条数的方法是使用一个num数组 /** * 阅读全文
posted @ 2020-10-07 12:13 Garrett_Wale 阅读(504) 评论(0) 推荐(0) 编辑
摘要: 不等式 ECNU-3304 #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<string> #include<cmath> #include<map> #include<vector 阅读全文
posted @ 2020-10-07 11:05 Garrett_Wale 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 定西 ECNU-3531 #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<string> #include<cmath> #include<map> #include<vector> 阅读全文
posted @ 2020-10-07 10:02 Garrett_Wale 阅读(103) 评论(0) 推荐(0) 编辑