相邻的房子间至少要有1的距离,高度相邻的房子间最多能距离d,根据这些条件建图后,要注意一点要看1和n的相对位置,如果1在n的左边,求1到n的最短路,dis【n】就是答案(排除无解);否则求n到1的最短路,dis【1】就是答案错了好几次,inf设的不够大。。。。。View Code #include<stdio.h>#include<string.h>#include<queue>#include<algorithm>using namespace std;struct node { int h,id;}p[1010];const int INF Read More
posted @ 2011-12-10 18:13 Because Of You Views(411) Comments(0) Diggs(0) Edit