摘要: Problem Description某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。Input测试输入包含若干测试用例。每个测试用例的第1行给出村庄数目N ( #include#include#includeusing namespace std;int p[105],n,sum;void init(){int i;for(i=1;i<=n;i++) p[i]=i;}int find(int x){ 阅读全文
posted @ 2013-09-16 16:39 forevermemory 阅读(123) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionThere was no donkey in the province of Gui Zhou, China. A trouble maker shipped one and put it in the forest which could be considered as an N×N grid. The coordinates of the up-left cell is (0,0) , the down-right cell is (N-1,N-1) and the cell below the up-left cell is (1,0). 阅读全文
posted @ 2013-09-16 10:11 forevermemory 阅读(438) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionIn the ancient three kingdom period, Zhuge Liang was the most famous and smartest military leader. His enemy was Shima Yi, who always looked stupid when fighting against Zhuge Liang. But it was Shima Yi who laughed to the end. Once, Zhuge Liang sent the arrogant Ma Shu to defend J 阅读全文
posted @ 2013-09-16 00:56 forevermemory 阅读(477) 评论(0) 推荐(0) 编辑