This problem is simple if you start from the bottom and make your way up. Consider a triangle
1
1 2
4 1 2
2 3 1 1
. - 4, 3, 7 ( , ). 1, 3, 4 ( , ). 2, 3 ( , ). , ,
1
1 2
7 4 3
, . . 1 7, 8, 2 4, 6.
1
8 6
, 1 8, 9, .
. , . ,
1
1
2 3
1
2 3
6 4 5
, ,
1
2 3
6 4 5
8 9 6 6
- , 9. , , , , , . , ; , , .
, . , , , . : , - - , , - , , , , , , , , . , , , .
, Project Euler. Code Chef , -, , .