随笔分类 - 算法 / 搜索与图论
摘要:1.稠密图用邻接矩阵来存 朴素版dijkstra 算法 acwing 849 1 #include<bits/stdc++.h> 2 using namespace std; 3 4 const int N = 510; 5 int n,m; 6 int dis[N]; //每个点到起点的最短距离(
阅读全文
摘要:1.树的重心 acwing 846 1 #include <iostream> 2 #include <algorithm> 3 #include <cstring> 4 5 using namespace std; 6 7 const int N = 1e5 + 10; //数据范围是10的5次方
阅读全文
摘要:DFS : acwing 842 递归搜索树 题库 - AcWing 1 #include<iostream> 2 using namespace std; 3 4 const int N = 10; 5 int n; 6 int path[N]; 7 bool st[N]; 8 9 void df
阅读全文