Program.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace Pruf
  9. {
  10. internal class Program
  11. {
  12. public static List<List<int>> ConvertToLisListInt(string[] allLines) => allLines.Select(line=>line.Split(' ').Select(int.Parse).ToList()).ToList();
  13. static void Main(string[] args)
  14. {
  15. Trace.Listeners.Add(new TextWriterTraceListener("Trace and debug1.txt"));
  16. Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
  17. Trace.AutoFlush = true;
  18. string inputPath = "C:\\Users\\Громовие\\source\\repos\\Ekzamen\\Ekzamen\\input.txt";
  19. string outputPath = "C:\\Users\\Громовие\\source\\repos\\Ekzamen\\Ekzamen\\output.txt";
  20. string[] allLines = File.ReadAllLines(inputPath);
  21. int indexSeparator = Array.IndexOf(allLines, "-");
  22. string[] branchsOne = allLines.Take(indexSeparator).ToArray();
  23. string[] branchsTwo = allLines.Skip(indexSeparator+1).ToArray();
  24. List<List<int>> firstGraph = ConvertToLisListInt(branchsOne);
  25. Pr obj1 = new Pr(firstGraph);
  26. obj1.RealizationAlg();
  27. Trace.WriteLine(obj1.ToString());
  28. File.WriteAllText(outputPath, $"{obj1.ToString()}");
  29. }
  30. }
  31. }