Current location - Health Preservation Learning Network - Fitness coach - PASCAL product maximization high-precision dynamic programming method is superior and has error correction function.
PASCAL product maximization high-precision dynamic programming method is superior and has error correction function.
This problem can be solved without high-precision int64

var sum,f:array);

For i:= 1 to n do

for j:=i to n do

val(copy(st,I,j-i+ 1),sum[i,j]);

For i:= 1 to n do

For j:= 1 to i- 1 do.

begin

max:= 0;

For k:= 1 to i do

If max & ltf[k, j- 1]*sum[k+ 1, i] then max:=f[k, j- 1]*sum[k+ 1, i];

f[i,j]:= max;

End;

writeln(f[n,m]);

End.