Maximum triangle path sum: Difference between revisions

m
m (→‎{{header|Ring}}: Remove vanity tags)
Line 703:
=={{header|Elena}}==
{{trans|C#}}
ELENA 3.34 :
<lang elena>import system'routines.
import extensions.
import extensions'math.
 
literal input = "55
94 48
Line 727:
27 02 92 23 08 71 76 84 15 52 92 63 81 10 44 10 69 93".
programpublic =program
[
var list := IntMatrix new(18,19).
int i := 0.
int j := 0.
input split(forwards'newLine); forEach(:line)<literal>
[
j := 0.
Line 739:
[
list[i][j] := num toInt.
j += 1
].
i += 1.
].
16 to:0 do(:i)<int>
[
0 till:18 do(:j)<int>
[
list[i][j] := mathControl max(list[i][j] + list[i+1][j], list[i][j] + list[i+1][j+1]).
].
].
console printLine("Maximum total: ", list[0][0]).
].</lang>
{{out}}
<pre>
Anonymous user