Create a program to find the smallest travel cost
to surround all the cities on the list
trip and return to the origin with the following criteria:
Input consists of the city followed by a city name each
rows corresponding number of cities
then the number of tickets available flight paths followed
and the appropriate amount of ticket costs.
The output displays the used tickets and the cost if there is a possible path, if no path to that goal show Not Available.
example input 1:
3
Jakarta
Bandung
Surabaya
6
Jakarta-Bandung 15
Jakarta-Surabaya 12
Bandung-Jakarta 20
Bandung-Surabaya 10
Surabaya-Bandung 19
Surabaya-Jakarta 5
What is that you don't understand, I mean you even have examples.
Some hint
- use the arrays/vectors to store the cities,fare etc
- read the cities to visit
- check if the cities exist in the array
- make sequence of cities to visit
- if multiple sequence come up, then sum the fare and see which is less