fork(1) download
  1. BCTSP2 - Travelling Salesman Problem 2
  2. A traveler who wants to visit n cities T1, ..., Tn. Comes from one particular city, people who plan to travel
  3. through all other cities, each city exactly once and then passing back the city of origin.
  4.  
  5. Call C [i] [j] is the cost of going from city Ti to Tj. Look for a satisfactory itinerary of the problem
  6. so that the cost is minimal.
  7.  
  8.  
  9.  
  10. Note: all TSP 2 aims to train for greedy algorithm, this algorithm does not guarantee always found answers optimum,
  11. however for the purpose of practicing the test of TSP 2 were selected for greed also found is the efficient solution.
  12.  
  13. Input
  14. The first line consists of an integer n (0 <n <= 1000) - the number of cities
  15.  
  16. The next N lines, the ith row enter n integer C [i] [j] (0 <= j <n, 0 <C [i] [j] <= 10 ^ 9) - is the cost of
  17. going from city Ti to Tj and vice versa
  18.  
  19. Output
  20. Print the minimum cost can be achieved
  21.  
  22. Example
  23. Input:
  24.  
  25.  
  26. 44
  27. 0 20 35 42
  28. 20 0 34 30
  29. 35 34 0 12
  30. 42 30 12 0
  31. 0 20 35 42
  32. 20 0 34 3035 34 0 1242 30 12
  33.  
  34.  
  35. Output:
  36. 97
  37. Submit solution!
  38.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:1: error: ‘BCTSP2’ does not name a type
 BCTSP2 - Travelling Salesman Problem 2
 ^~~~~~
stdout
Standard output is empty