Hey everybody,So I've given a triangular pyramid of numbers with N (1<?=1000) levels. I need to write a program that finds the highest sum of numbers starting from the top level and ending at the bottom level of the pyramid. At each step I can go diagonally down to the left or diagonally down to the right as indicated by the lines joining the numbers in the diagrams below.
The first line of the input file INPUT.TXT contains N. The following N lines contain the integers for each level, separated by a single space. These integers are positive and have a maximum value of 100.
The output file OUTPUT.TXT should contain a single number, which is the maximum sum that the program has found.
Input.Txt
3
8
12 1
2 7 8
OUTPUT.TXT
27
Please help :P