public void Test_1() { var buffer = new string[] { "6", "100 200 100 500 100 600", "1 2", "2 3", "2 5", "4 5", "5 6" }; var result = CutTheTree.Test(buffer); Assert.AreEqual(400, result); }
public void MainFlow(string inputString, string expectedString) { var input = new StringReader(inputString); int n = Convert.ToInt32(input.ReadLine().Trim()); List <int> data = input.ReadLine().TrimEnd().Split(' ').ToList().Select(dataTemp => Convert.ToInt32(dataTemp)).ToList(); List <List <int> > edges = new List <List <int> >(); for (int i = 0; i < n - 1; i++) { edges.Add(input.ReadLine().TrimEnd().Split(' ').ToList().Select(edgesTemp => Convert.ToInt32(edgesTemp)).ToList()); } int result = CutTheTree.cutTheTree(data, edges); Assert.AreEqual(expectedString, result.ToString()); }