Program.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 debug.txt"));
  16. Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
  17. Trace.AutoFlush = true;
  18. string inputPath = "C:\\Users\\kkrok\\OneDrive\\Desktop\\pruf\\Pruf\\input.txt.txt";
  19. string outputPath = "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. }