| closed account (L304izwU) | |
|
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 example output 1: Jakarta-Bandung 15 Bandung-Surabaya 10 Surabaya-Jakarta 5 Total: 30 example input 2: 3 Jakarta Bandung Surakarta 4 Jakarta-Bandung 10 Jakarta-Surakarta 20 Bandung-Surakarta 15 Surakarta-Bandung 5 example output 2: Not Available Please help me.....I don't understand my assignment above. thank you in advance.... :) | |
|
|
|
| Santosh Reddy (58) | |
|
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 | |
|
|
|
| Xphysics (16) | |
| First initialize all trips cost as a integer then compare them using loops such as if else while... to find bigger or smallest or specific cost. | |
|
|
|