using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; namespace MinEl { internal class Program { static double[][] Matrix(string[] matrixString) => matrixString.Select(line=>line.Split(' ').Select(double.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 = "C:\\Users\\kkrok\\OneDrive\\Desktop\\min\\MinEl\\Input.txt"; string outputPath = "output.txt"; string[] allLines = File.ReadAllLines(inputPath); int separatorOne = Array.IndexOf(allLines, "-"); string[] transportTaskOne = allLines.Take(separatorOne).ToArray(); int separotTwoTaskOne = Array.IndexOf(transportTaskOne,"/"); string[] arrayTarifstringOne = transportTaskOne.Take(separotTwoTaskOne).ToArray(); double[][] arrayTarifOne = Matrix(arrayTarifstringOne); string[] suppliersAndCustomersStringOne = transportTaskOne.Skip(separotTwoTaskOne + 1).ToArray(); int[][] suppliersAndCustomersOne = suppliersAndCustomersStringOne.Select(s => s.Split(' ').Select(int.Parse).ToArray()).ToArray(); MinimalEl obj = new MinimalEl(arrayTarifOne, suppliersAndCustomersOne); obj.RealizationAlg(); Trace.WriteLine(obj.ToString()); File.WriteAllText(outputPath, obj.ToString()); Console.ReadKey(); } } }