摘要: View Code 1 //zzuli1220 2 #include<stdio.h> 3 #include<queue> 4 using namespace std; 5 int n,k; 6 int f[100001]; 7 bool a[100001]; 8 queue<int>q; 9 void bfs()10 {11 int x;12 a[n]=1;13 q.push(n);14 while(!q.empty())15 {16 x=q.front();17 q.pop();18 if(x==k)... 阅读全文
posted @ 2012-07-19 17:24 zlyblog 阅读(213) 评论(0) 推荐(0)
摘要: 北大2421题意:输入一个数n,代表村庄数,然后输入n行n列的数组,第i行第j列代表第i个村庄与第j个村庄的距离。然后输入一个数m,接下来m行,每行代表某两个村庄之间的路已被修;输出要修的最短距离,保证每两个村庄之间都可以直接或间接的联系。View Code 1 //2421C++ 2 #include<stdio.h> 3 #include<string.h> 4 #include<stdlib.h> 5 6 #define Max 1005 7 int n,a[Max][Max]; 8 int set[Max],f[Max][Max]; 9 struct 阅读全文
posted @ 2012-07-19 11:40 zlyblog 阅读(248) 评论(0) 推荐(0)