logo search
Диссертация_2013_Даулбаева ММ

Продолжение приложения б

v_m := MaxInt;

x_m := -1;

index := 1;

while (index < f2) do

begin

f := plan.Arr[ path[index].x, path[index].y ];

if (f < v_m) then

begin

v_m := f;

x_m := index;

end;

inc(index,2);

end;

for index := 0 to f2-1 do

begin

f := plan.Arr[ path[index].x, path[index].y ];

if ( (index and 1) = 0 ) then f := f + v_m

else f := f - v_m;

plan.Arr[ path[index].x, path[index].y ] := f;

end;

end;

procedure TForm1.Button5Click(Sender: TObject);

procedure c( x, y: integer; s: string );

begin

StringGrid1.Cells[ x, y ] := s;

end;

begin

StringGrid1.ColCount := 7;

StringGrid1.RowCount := 5;

c( 2, 1, '100' );

c( 3, 1, '110' );

c( 4, 1, '90' );

c( 5, 1, '100' );

c( 6, 1, '130' );

c( 1, 2, '150' );

c( 1, 3, '240' );