摘要: //program 5-3 #include #include #define MX 50 using namespace std; int x[MX]; //解分量 int map[MX][MX]; //图的邻接矩阵 int sum=0; //记录解的个数 int n,m,edge; //节点数和颜色数 //创建邻接矩阵 void CreatMap() { ... 阅读全文
posted @ 2019-08-10 18:23 xjyxp01 阅读(851) 评论(0) 推荐(0) 编辑
摘要: //program 2-6 #include <iostream> using namespace std; const int INF = 0x3fffffff; const int N = 100; bool s[N]; int closest[N]; int lowcost[N]; void Prim(int n, int u0, int c[N][N]) { //顶点个数n、开始顶点u0、 阅读全文
posted @ 2019-08-10 18:15 xjyxp01 阅读(904) 评论(0) 推荐(0) 编辑
摘要: //program 2-4 #include #include #include using namespace std; const int N=100; // 城市的个数可修改 const int INF=1e7; // 无穷大10000000 int map[N][N],dist[N],p[N],n,m;//n城市的个数,m为城市间路线的条数 bool flag[N]; //如果s[i]... 阅读全文
posted @ 2019-08-10 11:00 xjyxp01 阅读(477) 评论(0) 推荐(0) 编辑