http://poj.org/problem?id=1985
题意:给一棵树,求树的直径
方法一)tree-DP 类似HDU2196,可以参见:
http://www.cnblogs.com/celia01/archive/2012/07/30/2615842.html
#include <cstdio>
#include <iostream>
#include <fstream>
#include <cstring>
#include <vector>
using namespace std;
#define MAX(a,b) ((a)>(b)?(a):(b))
struct edge
{
int ev,w;
edge(){}
edge(int a,int b):ev(a),w(b){}
};
vector <edge> elist[40009];
int g[40009],f[400......
阅读全文