12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace MethodDeikstraEXZ
- {
- internal class Program
- {
- public static int[][] Matrix(string[] matrix) => matrix.Select(line => line.Split(' ').Select(int.Parse).ToArray()).ToArray();
- static void Main(string[] args)
- {
- Trace.Listeners.Add(new TextWriterTraceListener("Trace and debug.txt"));
- Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
- Trace.AutoFlush = true;
- string inputPath = "Input.txt";
- string outputPath = "Output.txt";
- string[] allLines = File.ReadAllLines(inputPath);
- int separator = Array.IndexOf(allLines, "-");
- string[] matrixOne = allLines.Take(separator).ToArray();
- string[] matrixTwo = allLines.Skip(separator + 1).ToArray();
- int[][] intMatrixOne = Matrix(matrixOne);
- int[][] intMatrixTwo = Matrix(matrixTwo);
- AlgDeikstra obj = new AlgDeikstra(intMatrixOne);
- obj.RealizationAlg();
- Trace.WriteLine("Trace\n" + obj.ToString());
- Debug.WriteLine("Debug\n" + obj.ToString());
- File.WriteAllText(outputPath, obj.ToString());
- Console.ReadKey();
- }
- }
- }
|