Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            if (args.Length != 3)
            {
                Console.WriteLine("Invalid arguments count.");

                return;
            }

            var triangle = TriangleParser.ParseArgs(args);

            if (triangle.Equals(default(Triangle)))
            {
                return;
            }

            if (TriangleTypeQualifier.IsItPossibleToBuildTriangle(triangle))
            {
                var type = TriangleTypeQualifier.QualifyTriangle(triangle);

                Console.WriteLine($"Triangle is {type}.");
            }

            else
            {
                Console.WriteLine("Triangle cannot be build.");
            }
        }
Exemplo n.º 2
0
        public static int Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("Please specify a single file path argument.");
                return(-1);
            }

            var triangleParser           = new TriangleParser(new FileReader());
            var triangleTraversalService = new TriangleTraversalService();

            var parsedInput = triangleParser.ParseInput(args[0]);
            var result      = triangleTraversalService.FindHighestSumPath(parsedInput);

            PrintResults(result.Reverse().ToArray());
            return(0);
        }