If you have five cities A, B, C, D, E, then you'll have a 5 by 5 matrix with its entries are distance between them. Travel costs are predetermined. If you find a solution in a brute force manner, there are 5! cases described by permutations.
n! is a really big number for a large n, so you might need to find an approximate solution of TSP by using heuristic algorithms.