You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Urban_subway_navigation_system/代码123.cpp

352 lines
15 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
#include <iostream>
using namespace std;
#define ALLNameNum 99
#define INF 99999
typedef int dist[ALLNameNum];
typedef int path[ALLNameNum];
typedef struct
{
char name[100];
char intro[999];
int x, y;
}SITE;
typedef struct
{
SITE site[ALLNameNum];
int length[ALLNameNum][ALLNameNum];
}MAP;
MAP M;
int N = 0;
path p;
dist d;
void init()
{
int i, j;
strcpy(M.site[1].name, "ƻ<EFBFBD><EFBFBD>԰");
strcpy(M.site[1].intro, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʯ<EFBFBD><EFBFBD>ɽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>ƻ<EFBFBD><EFBFBD>԰<EFBFBD><EFBFBD>·");
strcpy(M.site[2].name, "<EFBFBD>ų<EFBFBD>");
strcpy(M.site[2].intro, "λ<EFBFBD>ڱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʯ<EFBFBD><EFBFBD>ɽ<EFBFBD><EFBFBD>ʯ<EFBFBD><EFBFBD>ɽ·<EFBFBD><EFBFBD>ų<EFBFBD>С<EFBFBD>ֽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy(M.site[3].name, "<EFBFBD>˽<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>԰");
strcpy(M.site[3].intro, "ʯ<EFBFBD><EFBFBD>ɽ<EFBFBD><EFBFBD><EFBFBD>˽<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŷ<EFBFBD><EFBFBD><EFBFBD>");
strcpy(M.site[4].name, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy(M.site[4].intro, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD>");
strcpy(M.site[5].name, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy(M.site[5].intro, "λ<EFBFBD>ڱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>֡<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>֡<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><EFBFBD>");
strcpy(M.site[6].name, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy(M.site[6].intro, "λ<EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֺ<EFBFBD><EFBFBD>ϳ<EFBFBD><EFBFBD>ֽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DZ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><EFBFBD><EFBFBD>޹<EFBFBD>˾<EFBFBD><EFBFBD>Ӫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD>վ<EFBFBD><EFBFBD>Ҳ<EFBFBD>DZ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD><EFBFBD>м<EFBFBD>վ");
strcpy(M.site[7].name, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy(M.site[7].intro, "λ<EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>DZ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><EFBFBD><EFBFBD>޹<EFBFBD>˾<EFBFBD><EFBFBD>Ӫ<EFBFBD>ij<EFBFBD>վ<EFBFBD><EFBFBD>Ҳ<EFBFBD>DZ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD>ߡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><EFBFBD><EFBFBD>ߵĻ<EFBFBD><EFBFBD><EFBFBD>վ");
strcpy(M.site[8].name, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy(M.site[8].intro, "λ<EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>г<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD>·<EFBFBD>");
strcpy(M.site[9].name, "<EFBFBD><EFBFBD>¥<EFBFBD><EFBFBD><EFBFBD>");
strcpy(M.site[9].intro, "<EFBFBD>DZ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>8<EFBFBD><EFBFBD><EFBFBD>ߵĻ<EFBFBD><EFBFBD><EFBFBD>վ,λ<>ڱ<EFBFBD><DAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB6AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>紦,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><>ʤ<EFBFBD>Ŷ<EFBFBD><C5B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>¥<EFBFBD><C2A5><EFBFBD>-<2D>ɹ<EFBFBD>¥<EFBFBD><C2A5><EFBFBD>ֽ<EFBFBD><D6BD>");
strcpy(M.site[10].name, "Ӻ<EFBFBD>͹<EFBFBD>");
strcpy(M.site[10].intro, "λ<EFBFBD>ڱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӻ<EFBFBD>͹<EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><EFBFBD>");
strcpy(M.site[11].name, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy(M.site[11].intro, "λ<EFBFBD>ڱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>紦,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EBB3AF><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4>-<2D><><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD><C5B1><EFBFBD>ֽ<EFBFBD><D6BD>");
strcpy(M.site[12].name, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ");
strcpy(M.site[12].intro, "λ<EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD>");
strcpy(M.site[13].name, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy(M.site[13].intro, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><EFBFBD><EFBFBD>ߺͱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>5<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ˽<EFBFBD><EFBFBD>㣬λ<EFBFBD>ڱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD>Ŷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>ֽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy(M.site[14].name, "<EFBFBD><EFBFBD>ƽ<EFBFBD><EFBFBD>");
strcpy(M.site[14].intro, "λ<EFBFBD>ڱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>»<EFBFBD><EFBFBD>֣<EFBFBD><EFBFBD><EFBFBD><EFBFBD>»<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֣<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŷ<EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><EFBFBD>");
strcpy(M.site[15].name, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy(M.site[15].intro, "λ<EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DZ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><EFBFBD><EFBFBD>ߺͱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD><EFBFBD><EFBFBD>ߵĻ<EFBFBD><EFBFBD><EFBFBD>վ");
strcpy(M.site[16].name, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy(M.site[16].intro, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD>DZ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ,λ<>ڱ<EFBFBD><DAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD>");
strcpy(M.site[17].name, "<EFBFBD><EFBFBD>ֱ<EFBFBD><EFBFBD>");
strcpy(M.site[17].intro, "λ<EFBFBD>ڱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD>");
strcpy(M.site[18].name, "Բ<EFBFBD><EFBFBD>԰");
strcpy(M.site[18].intro, "λ<EFBFBD>ڱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·");
strcpy(M.site[19].name, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy(M.site[19].intro, "λ<EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy(M.site[20].name, "<EFBFBD>йش<EFBFBD>");
strcpy(M.site[20].intro, "λ<EFBFBD>ڱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>йش<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD>");
strcpy(M.site[21].name, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ׯ");
strcpy(M.site[21].intro, "<EFBFBD>DZ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD><EFBFBD><EFBFBD>ߺͱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>10<EFBFBD><EFBFBD><EFBFBD>ߵĻ<EFBFBD><EFBFBD><EFBFBD>վ");
strcpy(M.site[22].name, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ");
strcpy(M.site[22].intro, "λ<EFBFBD>ڱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD>");
strcpy(M.site[23].name, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD>");
strcpy(M.site[23].intro, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD>վλ<EFBFBD>ڹ<EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD>ݵ<EFBFBD><EFBFBD>ϲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy(M.site[24].name, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>԰");
strcpy(M.site[24].intro, "λ<EFBFBD>ڱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy(M.site[25].name, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ");
strcpy(M.site[25].intro, "λ<EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>з<EFBFBD>̨<EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD>·<EFBFBD>");
strcpy(M.site[26].name, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy(M.site[26].intro, "λ<EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy(M.site[27].name, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҽҩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy(M.site[27].intro, "<EFBFBD>DZ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ,λ<>ڱ<EFBFBD><DAB1><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD>");
strcpy(M.site[28].name, "<EFBFBD><EFBFBD>̳<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy(M.site[28].intro, "λ<EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy(M.site[29].name, "<EFBFBD><EFBFBD>ͨԷ");
strcpy(M.site[29].intro, "<EFBFBD>DZ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>5<EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD><EFBFBD>Ҳ<EFBFBD>DZ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD><EFBFBD>λ<EFBFBD>ڱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD>ƽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD>̫ƽׯ<EFBFBD>ж<EFBFBD><EFBFBD>ֽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
strcpy(M.site[30].name, "<EFBFBD><EFBFBD>ͨԷ<EFBFBD><EFBFBD>");
strcpy(M.site[30].intro, "λ<EFBFBD>ڱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD>ƽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨԷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>̫ƽׯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>400<EFBFBD>״<EFBFBD>");
for (i = 1; i <= ALLNameNum; i++)
{
for (j = 1; j <= ALLNameNum; j++)
{
M.length[i][j] = INF;
}
}
for (i = 1; i <= ALLNameNum; i++)
M.length[i][i] = 0;
M.length[1][2] = M.length[2][1] = 30;
M.length[1][3] = M.length[3][1] = 30;
M.length[2][3] = M.length[3][2] = 90;
M.length[2][4] = M.length[4][2] = 70;
M.length[3][5] = M.length[5][3] = 50;
M.length[3][6] = M.length[6][3] = 50;
M.length[4][5] = M.length[5][4] = 50;
M.length[4][7] = M.length[7][4] = 100;
M.length[5][6] = M.length[6][5] = 30;
M.length[6][7] = M.length[7][6] = 110;
M.length[6][10] = M.length[10][6] = 20;
M.length[7][8] = M.length[8][7] = 30;
M.length[7][9] = M.length[9][7] = 30;
M.length[7][10] = M.length[10][7] = 30;
M.length[8][9] = M.length[9][8] = 30;
M.length[9][10] = M.length[10][9] = 60;
M.length[9][11] = M.length[11][9] = 40;
M.length[10][11] = M.length[11][10] = 40;
M.length[11][12] = M.length[12][11] = 100;
M.length[11][13] = M.length[13][11] = 50;
M.length[12][13] = M.length[13][12] = 60;
M.length[12][15] = M.length[15][12] = 30;
M.length[12][17] = M.length[17][12] = 170;
M.length[13][14] = M.length[14][13] = 70;
M.length[13][15] = M.length[15][13] = 30;
M.length[13][16] = M.length[16][13] = 50;
M.length[14][16] = M.length[16][14] = 50;
M.length[15][16] = M.length[16][15] = 20;
M.length[16][17] = M.length[17][16] = 30;
M.length[17][18] = M.length[18][17] = 60;
M.length[17][19] = M.length[19][17] = 30;
M.length[17][20] = M.length[20][17] = 170;
M.length[18][20] = M.length[20][18] = 70;
M.length[19][21] = M.length[21][19] = 30;
M.length[20][21] = M.length[21][20] = 50;
M.length[21][22] = M.length[22][21] = 50;
M.length[21][24] = M.length[24][21] = 20;
M.length[22][23] = M.length[23][22] = 30;
M.length[23][25] = M.length[25][23] = 60;
M.length[23][26] = M.length[26][23] = 30;
M.length[24][25] = M.length[25][24] = 170;
M.length[25][27] = M.length[27][25] = 70;
M.length[26][27] = M.length[27][26] = 30;
M.length[27][28] = M.length[28][27] = 50;
M.length[27][29] = M.length[29][27] = 50;
M.length[28][29] = M.length[29][28] = 20;
M.length[29][30] = M.length[30][29] = 30;
N = 30;
}
void queryAllSite()
{
int t;
printf("<EFBFBD><EFBFBD><EFBFBD>еص<EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>\n");
for (t = 1; t <= N; t++)
{
printf("<EFBFBD><EFBFBD>ţ<EFBFBD> %d\n <20>ص㣺%s\n <20><><EFBFBD>ܣ<EFBFBD>%s\n", t, M.site[t].name, M.site[t].intro);
}
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
getch();
}
void querySite()
{
int a;
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ѯ<EFBFBD>ĵص<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǣ<EFBFBD>");
scanf("%d", &a);
if (a > N)
printf("<EFBFBD><EFBFBD>ѯ<EFBFBD>ĵص㲻<EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD><EFBFBD>ѯʧ<EFBFBD>ܣ<EFBFBD>");
else
printf("<EFBFBD><EFBFBD>ţ<EFBFBD>%d\n <20>ص㣺%s\n <20><><EFBFBD>ܣ<EFBFBD>%s\n", a, M.site[a].name, M.site[a].intro);
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD>");
getch();
}
void dijkstraAllSite()
{
int v0;
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD>ĵص㣺");
scanf("%d", &v0);
bool flag[ALLNameNum];
//v<><76>ʾ<EFBFBD><CABE>һ<EFBFBD><D2BB><EFBFBD>ڵ㣬k<E3A3AC><6B>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>
int i, k, j, v, min, x;
for (v = 1; v <= N; v++)
{
flag[v]=0;
d[v] = M.length[v0][v];
if (d[v] < INF && d[v] != 0)
p[v] = v0;
else
p[v] = -1;
}
flag[v0] = 1;
d[v0] = 0;//ԭ<><D4AD><EFBFBD><EFBFBD><EFBFBD>
for (i = 2; i <= N; i++)
{
min = INF;
for (k = 1; k <= N; ++k)
if (!flag[k] && d[k] < min)
{//û<>б<EFBFBD><D0B1><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD>Ҿ<EFBFBD><D2BE><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD>Сֵ<D0A1><D6B5><EFBFBD><EFBFBD><EFBFBD>
v = k;
min = d[k];
}
if (min == INF)
return;
flag[v] = 1;
for (k = 1; k <= N; ++k)
if (!flag[k] && (min + M.length[v][k] < d[k]))
{
d[k] = min + M.length[v][k];//<2F><>k<EFBFBD>ľ<EFBFBD><C4BE><EFBFBD>
p[k] = v;//k<>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>v
}
}
}
void printAllSite()
{
int st[ALLNameNum], i, pre, top = -1;
for (i = 1; i <= N; i++)
{
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>%2d<32><64><EFBFBD>ܾ<EFBFBD><DCBE><EFBFBD>Ϊ: %5d , <20><><EFBFBD><EFBFBD>·<EFBFBD><C2B7>Ϊ:", i, d[i]);
st[++top] = i;
pre = p[i];
while (pre != -1)
{
st[++top] = pre;
pre = p[pre];
}
while (top > 0)
{
printf("%d", st[top--]);
if (top > 0)
printf("--->");
}
}
getch();
}
void dijkstraTwoSite()
{
int v0;
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>ص<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>ı<EFBFBD>ţ<EFBFBD>");
scanf("%d", &v0);
bool flag[ALLNameNum];
int i, k, j, v, min, x;
for (v = 1; v <= N; v++)
{
flag[v] = 0;
d[v] = M.length[v0][v];
if (d[v] < INF && d[v] != 0)
p[v] = v0;
else
p[v] = -1;
}
flag[v0] = 1;
d[v0] = 0;
for (i = 2; i <= N; i++)
{
min = INF;
for (k = 1; k <= N; ++k)
if (!flag[k] && d[k] < min)
{
v = k;
min = d[k];
}
if (min == INF)
return;
flag[v] = 1;
for (k = 1; k <= N; ++k)
if (!flag[k] && (min + M.length[v][k] < d[k]))
{
d[k] = min + M.length[v][k];
p[k] = v;
}
}
}
void printTwoSite()
{
int y;
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD>ĵص<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>ı<EFBFBD>ţ<EFBFBD>");
scanf("%d", &y);
int st[ALLNameNum], i, pre, top = -1;
for (i = 1; i <= N; i++)
{
if (i == y)
printf("\n<EFBFBD>ܾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %5d , <20><><EFBFBD><EFBFBD>·<EFBFBD><C2B7>Ϊ:", d[i]);
st[++top] = i;
pre = p[i];
while (pre != -1)
{
st[++top] = pre;
pre = p[pre];
}
while (top > 0)
{
if (i == y)
{
printf("%d", st[top--]);
if (top > 0)
printf("--->");
}
else
top--;
}
}
getch();
}
main()
{
init();
int x;
while (1)
{
printf("**********************************************************************\n");
printf("* <20><>ӭʹ<D3AD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD>߹滮ϵͳ *\n");
printf("**********************************************************************\n");
printf("\n 0<><30><EFBFBD>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD> ");
printf("\n 1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD><EFBFBD><E3BCB0><EFBFBD><EFBFBD><EFBFBD>");
printf("\n 2<><32><EFBFBD><EFBFBD>ѯijһ<C4B3><D2BB><EFBFBD><EFBFBD>վ<EFBFBD><EFBFBD><E3BCB0><EFBFBD><EFBFBD><EFBFBD>");
printf("\n 3<><33><EFBFBD><EFBFBD>ѯijһվ<D2BB><EFBFBD><E3B5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD><D5BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7>");
printf("\n 4<><34><EFBFBD><EFBFBD>ѯij<D1AF><C4B3><EFBFBD><EFBFBD>վ<EFBFBD><D5BE>֮<EFBFBD><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7> ");
printf("\n*******************************************************************");
printf("<EFBFBD>ص<EFBFBD><EFBFBD>Ŷ<EFBFBD>Ӧ<EFBFBD><EFBFBD>\n");
printf(" 1.ƻ<><C6BB>԰ 2.<2E>ų<EFBFBD> 3.<2E>˽<EFBFBD><CBBD><EFBFBD><EFBFBD><EFBFBD>԰ 4.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 5.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 6.<2E><EFBFBD><ECB0B2><EFBFBD><EFBFBD> 7.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 8.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 9.<2E><>¥<EFBFBD><C2A5><EFBFBD> 10.Ӻ<>͹<EFBFBD>\n");
printf("11.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 12.<2E><><EFBFBD><EFBFBD>վ 13.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 14.<2E><>ƽ<EFBFBD><C6BD> 15.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 16.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 17.<2E><>ֱ<EFBFBD><D6B1> 18.Բ<><D4B2>԰ 19.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD> 20.<2E>йش<D0B9> 21.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ׯ 22.<2E><><EFBFBD><EFBFBD><EFBFBD>ѧ 23.<2E><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD> 24.<2E><><EFBFBD><EFBFBD>԰ 25.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ 26.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 27.<2E><><EFBFBD><EFBFBD>ҽҩ<D2BD><D2A9><EFBFBD><EFBFBD> 28<32><38>̳<EFBFBD><CCB3><EFBFBD><EFBFBD> 29.<2E><>ͨԷ 30.<2E><>ͨԷ<CDA8><D4B7>\n ");
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD>");
scanf("%d", &x);
if (x == 0)
break;
else
switch (x)
{
case 1:queryAllSite(); break;
case 2:querySite(); break;
case 3:dijkstraAllSite(); printAllSite(); break;
case 4:dijkstraAllSite(); printTwoSite(); break;
}
system("cls");
}
}