摘要: DescriptionGive a tree with n vertices,each edge has a length(positive integer less than 1001).Define dist(u,v)=The min distance between node u and v.Give an integer k,for every pair (u,v) of vertices is called valid if and only if dist(u,v) not exceed k.Write a program that will count how many pair 阅读全文
posted @ 2013-11-05 20:00 Oyking 阅读(206) 评论(0) 推荐(0) 编辑
摘要: DescriptionConsider a tree T with N (1 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int MAXN = 20010; 8 const int MAXE = 40010; 9 const int INF = 0x7fff7fff;10 11 int head[MAXN], size[MAXN], maxSize[MAXN], f[MAXN];12 int to[MAXE], next[MAXE];13 int n, ecnt;14 15 void init()... 阅读全文
posted @ 2013-11-05 16:49 Oyking 阅读(344) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=2631DescriptionBuilding and maintaining roads among communities in the far North is an expensive business. With this in... 阅读全文
posted @ 2013-11-05 13:04 Oyking 阅读(764) 评论(0) 推荐(1) 编辑