edit1.Text: = inttostr (n); p> end;
procedure TForm1.SpeedButton3Click (Sender: TObject);
var
o, min, imin, jmin: integer;
begin
SpeedButton3.Enabled: = false;
assignfile (f, extractfilepath (application.ExeName) + ' in.krs');
rewrite (f);
for i: = 1 to n do
for j: = 1 to n do
begin
if sg.cells [i, j] = '-' then
wrt: = 999
else
wrt: = strtoint (sg.cells [i, j]);
write (f, wrt);
end;
closefile (f);
assignfile (f, extractfilepath (application.exename) + ' in.krs');
reset (f);
for i: = 1 to n do
for j: = 1 to n do
begin
read (f, wrt);
if wrt = 999 then
sg.cells [i, j]: = '-'
else
sg.cells [i, j]: = inttostr (wrt);
a [i, j]: = wrt;
end;
closefile (f);
for i: = 1 to n do
m [i]: = 0;
m [1]: = 1;
repeat
o: = 0; p> min: = 100; imin: = 1; jmin: = 1;
for i: = 1 to n do
if m [i] = 1 then
for j: = 1 to n do
if (a [i, j] <> 0) and (A [i, j] <900) and (m [j] <> 1) then
begin
if a [i, j]
begin
min: = a [i, j];
imin: = i;
jmin: = j;
o: = 1;
end; end;
if o = 1 then
begin
ar [imin, jmin]: = min;
ar [jmin, imin]: = min; p> m [jmin]: = 1; p> end;
until o = 0;
speedbutton4.Click; p> end;
procedure TForm1.SpeedButton4Click (Sender: TObject);
begin
for i: = 1 to n do
for j: = 1 to n do
begin
if ar [i, j] = 0 then
sr.cells [i, j]: = '-' p> else
sr.cells [i, j]: = inttostr (ar [i, j]); p> end;
end;
procedure TForm1.SpeedButton5Click (Sender: TObject);
var
i, x, y: integer;
begin
idown: = 1;
form1.canvas.Refresh; p> if checkbox1.Checked then speedbutton8.Click;
image1.Canvas.brush.color: = clwhite;
image1.Canvas.pen.Color: = clwhite; p> image2.Canvas.brush.color: = clwhite;
image2.Canvas.pen.Color: = clwhite; p> image1.Canvas.Rectangle (0,0, image1.Width, image1.Height); p> image2.Canvas.Rectangle (0,0, image1.Width, image1.Height); p> with image1.Canvas do
begin
brush.color: = cllime;
pen.Color: = clblue; p> font.Name: = 'Courier'; p> font.Size: = 8; p> for i: = 1 to n do
for j: = 1 to n do
if (a [i, j] <> 0) and (A [i, j] <900) then
begin
pen.Width: = 1; p> moveto (vx [i] +7, vy [i] +7); p> lineto (vx [j] +7, vy [j] +7); p> brush.color: = clwhite;
textout (round ((vx [i] + vx [j] +4)/2), round ((vy [i] + vy [j] +1)/2), inttostr (a [i, j ])); p> end;
brush.color: = cllime;
for i: = 1 to n do