12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- using System;
- using System.CodeDom;
- using System.Collections.Generic;
- using System.Threading.Tasks;
- using System.Windows.Markup;
- namespace TravMerchant
- {
- internal class Program
- {
- static void Main()
- {
- var table = new int?[,] {
- { null, 20, 18, 12, 8 },
- { 5, null, 14, 7, 11 },
- { 12, 18, null, 6, 11 },
- { 11, 17, 11, null, 12 },
- { 5, 5, 5, 5, null },
- };
- var matrix = new ReducableMatrix(table);
- SolutionNode node = new SolutionNode(matrix);
- var pathPoints = node.Solve();
- int[] path = new int[pathPoints.Count];
- path[0] = 0;
- for (int i = 1; i < path.Length; i++)
- {
- path[i] = pathPoints.Find(point => point.Item1 == path[i - 1]).Item2;
- }
- for (int i = 0; i < path.Length; i++)
- {
- Console.Write($"{(char)('A' + path[i])} -> ");
- }
- Console.WriteLine('A');
- Console.ReadKey();
- }
- }
- }
|