map[5,5] =
{{0,AB,AC,AD,AE},{BA,0,BC,BD,BE},{CA,CB,0,CD,CE}{DA,DB,DC,0,DE}{EA,EB,EC,ED,0}}
采用深度优先方法
VisitMap (int nBegin)
{
int bVisited[MAX_NODE] = {0}
//0 未遍历 1 己遍历 2 己遍历,选中的节点
static nDistane = 0;
for (int i =0
i < MAX_NODE
i++)
{
if (!bVisited) continue
//如果己遍历
nDistane += map[nBegin,i];
if (nDistane == 100)//100公里
{
bVisited = 2;
}
VisitMap(i);
nDistane -= map[nBegin,i];
}
}