摘要: 枚举每一条边 将树分为两部分 分别dfs求出树的直径 从一点开始最长路加次长路为树的直径 #include<iostream> #include<vector>#include<algorithm>using namespace std;vector<int> G[100000];int n,s;i 阅读全文
posted @ 2016-07-22 13:43 TWhh 阅读(149) 评论(0) 推荐(0)
摘要: #include<iostream>#include<vector>#include<algorithm>using namespace std;struct edge{ int to,cost;};vector<edge> G[10000];int main(){ int v,e; while(c 阅读全文
posted @ 2016-07-22 09:29 TWhh 阅读(198) 评论(0) 推荐(0)