By the Huawei Software competition concluded that the game is really important, otherwise some opportunities will be missed, so seize the ZTE report algorithm contest, the game is titled:
The most powerful brain in the ending hive maze of abnormal level challenges, I believe that everyone is amazed! After the strongest brain finale, the ratings climbed, and even the Queen had a hard time with her children. In the animal world, in addition to bees, ants are the only animals that can be called live maps. In the complex and changeable nests, ants are always able to travel in the most efficient and fast way in the storage room (storing food). Today, she finished the latest episode, and released a new task: small ant classmate, I need maize corn, and then with some fruit, to help me find it. The ant is ready to go, the Queen said: "Oh, come back, I have not finished, there are a number of requirements as follows:
1. Young ant, you need to get the food as little as possible (the number on the route in the appendix shows the cost per two storage);
2. Small ants, you can only go through 9 storage room to get food (including two nodes, multiple times by the same node by the number of repetitions);
3. Small ants, you must pass through the corn between, fruit between (the Annex Map green node);
4. Don't forget, Anteater also in the road activities, once meet with anteater, life is dangerous! But the small ant group announcement has released the enemy information (the red section of the annex map);
5. Finally, do not forget, there are two sections of the road must pass, there is a mysterious gift I prepared to wait for you (attached map green section).
This small ant is puzzled, this and they usually find food in the collective activity rule is not the same , it seems this time need to act alone. How do you choose the road? Small Ant after a struggle, the manuscript piled up a pile, ah, finally found! Dear students, can you also design a generic path search algorithm to deal with various search constraints, find an optimal path to complete the task of the Queen's assignment?
Note:
1, the nest, there are several storage rooms (the circle in the Annex diagram), there are many ways to reach between the storage room (the topology map of each storage to see the annex);
2, the node itself passes without cost;
3, the graph is a non-directed graph, can be positive and negative two directions, both directions will be billed, and the same cost;
4. The starting and ending nodes are the S points and e points in the attachment diagram respectively.
5, the best path: the path that satisfies the restriction condition.
Because the results are not out, and later the final also inconvenient to publish their own algorithms, first write here
ZTE Algorithm Contest