示例#1
0
 public void CalculateSumExtended()
 {
     var triangle = new int[2][];
     triangle[0] = new int[5]    { 08 , 06 , 09 , 11 , 99 };
     triangle[1] = new int[6] { 22 , 33 , 66 , 12 , 15 , 20 };
     PathCalculator p = new PathCalculator(triangle);
     var sumRow = p.CalculateSum(triangle[1], triangle[0]);
     CollectionAssert.AreEqual(new int[6] { 30, 41, 75, 23, 114, 119 }, sumRow);
 }
示例#2
0
 public void CalculateSumSimple()
 {
     var triangle = new int[3][];
     triangle[0] = new int[1]    { 1 };
     triangle[1] = new int[2]  { 2 , 3 };
     triangle[2] = new int[3] { 4, 5, 6 };
     PathCalculator p = new PathCalculator(triangle);
     var sumRow = p.CalculateSum(triangle[2], triangle[1]);
     CollectionAssert.AreEqual(new int[3] { 6, 8, 9 }, sumRow);
 }
示例#3
0
文件: Program.cs 项目: xszaboj/euler
        static void Main(string[] args)
        {
            var reader = new Reader("triangle.txt");
            var arr = reader.ReadTriangle(15);
            reader.Print(arr);

            var calucator = new PathCalculator(arr);
            var max =calucator.GetMaxPath();
            Console.WriteLine("MAX: {0}", max);

            Console.ReadLine();
        }