.


:




:

































 

 

 

 


ң қ құ




 

1-40. , қ , ө ө, ұ ө ә құ .

41.stringgrid2 ұғ ә .

42.b ң .

43.g ң .

44. ө.

45.қ ө.

46-47. ө.

48. .

49-51. ө.

52.h c.

89-90. d ө,қ ғ ү.

102-110. min .

111. ,

112-118. қ.

146. ө ң ,

149. ө қ.

150.қ ө қ.

156.0- ғ қ min

160.0- ғ қ min .

162. қ.

164-171. max .

188-191.max ғ қ .

219. .

235-248. ңғ қ.

250. s- f (1) .

261.f(1) .

263-266. 2 ө.

267-270. 3 ө.

271-275. қ .

 

 

ә

 

ғғ ә

 

 

 

 

 

 

ұ қ ұ ң қ. ң ү ө әң ң ә

ү қ ү. Қ ғ Delphi7 ғ қ әң - ә ө .

қ, өң ұ қ ұ қғң ө ,қ ү қ ә ұ.

Қ , қ ғ , ә ү a қғғ ғ ң ұ қ ұқ ө ғ . қ, Delphi7 қ ұ ң қ .

 

Ғ Ә ҲDz̲

 

1 . . .1-3-.: , 1973

2 .., .. . : 1967.

3 ( 2 ). .1: / . ., .. : 1981.

4 .. қ ә ққ. : ҚҰ, 2004

5 . ( 2 ).

: 1985.

6 .., .. . 2. : . , 2005

 

unit Unit1;

 

interface

 

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, Grids;

 

type

mas = array [0..20,0..20] of real;

mas2 = array [1..2,1..100] of real;

abba = record

i:integer;

j:integer;

baga:real;

end;

mas1 = array [1..100] of abba;

TForm1 = class(TForm)

StringGrid1: TStringGrid;

StringGrid2: TStringGrid;

Edit1: TEdit;

Edit2: TEdit;

Button1: TButton;

Label1: TLabel;

Label2: TLabel;

Button2: TButton;

StringGrid3: TStringGrid;

procedure FormCreate(Sender: TObject);

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

 

var

Form1: TForm1;

count,

ind,

flag1,

bn,

gn,

ii,

jj

n:integer;

b,d,a:mas;

INF,OUTF:textfile;

C:mas1;

g:array [1..20] of integer;

e:mas2;

H:real;

 

 

implementation

 

procedure File_Read(var x:textfile; s:string; var y:mas; var a:integer);

var i,j:integer;

begin

AssignFile(x,s);

Reset(x);

read(x,a);

readln(x);

for i:=1 to n do

begin

y[i,0]:=i;

y[0,i]:=i;

end;

for i:=1 to a do

begin

for j:=1 to a do

read(x,y[i,j]);

readln(x);

end;

Closefile(x);

end;

 

procedure Min_Rows(var x:mas; var Y:real);

var i,j:integer;

flag:boolean;

min:real;

begin

for i:=1 to n do

begin

min:=1000;

flag:=false;

for j:=1 to n do

begin

if ((min > x[i,j]) and (x[i,j]>=0)) then

begin

min:=x[i,j];

flag:=true;

end;

end;

 

if (flag) then

begin

Y:=Y + min;

for j:=1 to n do

if (x[i,j]>=0) then

x[i,j]:=x[i,j] - min;

end;

end;

end;

 

procedure Min_Cols(var x:mas; var Y:real);

var i,j:integer;

min:real;

flag:boolean;

begin

for j:=1 to n do

begin

min:=1000;

flag:=false;

for i:=1 to n do

begin

if ((min > x[i,j]) and (x[i,j]>=0)) then

begin

min:=x[i,j];

flag:=true;

end;

end;

if (flag) then

begin

Y:=Y + min;

for i:=1 to n do

if (x[i,j]>=0) then

x[i,j]:=x[i,j] - min;

end;

end;

end;

 

 

procedure Find_C(var x:mas1; var y:integer; var max:real);

var i,j,k:integer;

min:real;

begin

y:=0;

for i:=1 to n do

begin

for j:=1 to n do

if ((i <> j) and (a[i,j]=0) and (a[i,j]>-1)) then

begin

inc(y);

C[y].i:=i;

C[y].j:=j;

end;

end;

 

for k:=1 to y do

begin

min:=1000;

for i:=C[k].i to C[k].i do

for j:=1 to n do

if ((i <> j) and (min > a[i,j]) and (j <> C[k].j) and (a[i,j]>-1)) then

min:=a[i,j];

C[k].baga:=min;

min:=1000;

for j:=C[k].j to C[k].j do

for i:=1 to n do

if ((i <> j) and (min > a[i,j]) and (i <> C[k].i) and (a[i,j]>-1)) then

min:=a[i,j];

C[k].baga:=C[k].baga + min;

end;

 

max:=-1;

for k:=1 to y do

if (max < C[k].baga) then

begin

max:=C[k].baga;

ii:=C[k].i;

jj:=C[k].j;

end;

end;

 

procedure Write_in_File();

var i,j,x,y:integer;

s:string;

begin

Append(OUTF);

writeln(OUTF);

writeln(OUTF);

writeln(OUTF,'');

writeln(OUTF);

for i:=1 to n do

if (1 = e[i,1]) then

x:=i;

 

s:=floattostr(e[x,1])+'-->'+floattostr(e[x,2]);

write(OUTF,s);

 

for i:=1 to n-1 do

begin

for j:=1 to n do

if (e[x,2] = e[j,1]) then

begin

y:=j;

break;

end;

s:='-->'+floattostr(e[y,2]);

write(OUTF,s);

x:=y;

end;

closefile(OUTF);

end;

 

 

{$R *.dfm}

 

procedure TForm1.FormCreate(Sender: TObject);

var i,j:integer;

begin

H:=0;

flag1:=0;

File_Read(INF,'input.txt',a,n);

count:=n;

bn:=n;

ind:=1;

gn:=0;

AssignFile(OUTF,'output.txt');

Rewrite(OUTF);

writeln(OUTF);

 

for i:=0 to n do

for j:=0 to n do

begin

d[i,j]:=a[i,j];

// b[i,j]:=a[i,j];

end;

 

Stringgrid1.ColCount:=n+1;

Stringgrid1.RowCount:=n+1;

Stringgrid3.ColCount:=n+1;

Stringgrid3.RowCount:=n+1;

 

for i:=0 to n do

for j:=0 to n do

if (a[i,j]= -1) then

Stringgrid1.Cells[j,i]:='x'

else

Stringgrid1.Cells[j,i]:=floattostr(a[i,j]);

end;

 

procedure TForm1.Button1Click(Sender: TObject);

var m1,k,i,j,m,flag,p,l:integer;

max:real;

s:string;

begin

dec(count);

Append(OUTF);

 

m:=0;

Min_Rows(a,H);

Min_Cols(a,H);

Find_C(C,m,max);

 

edit1.Text:=floattostr(H);

 

a[jj,ii]:=-1;

 

e[ind,1]:=ii;

e[ind,2]:=jj;

inc(ind);

 

Stringgrid3.ColCount:=bn;

Stringgrid3.RowCount:=bn;

 

dec(bn);

 

writeln(OUTF);

s:=floattostr(ii)+'-->'+floattostr(jj)+'('+floattostr(d[ii,jj])+') ';

write(OUTF,s);

 

for i:=1 to n do

a[i,jj]:=-2;

for j:=1 to n do

a[ii,j]:=-2;

 

l:=0;

for i:=0 to n do

begin

p:=-1;

flag:=0;

for j:=1 to n do

if (a[i,j] = -2) then

inc(flag);

for j:=0 to n do

if ((a[i,j]>-2) and (flag <> n)) then

begin

inc(p);

b[l,p]:=a[i,j];

end;

if (flag <> n) then

inc(l);

end;

 

for i:=0 to bn do

for j:=0 to bn do

begin

if (b[i,j]= -1) then

Stringgrid3.Cells[j,i]:='x';

if (b[i,j] >= 0) then

Stringgrid3.Cells[j,i]:=floattostr(b[i,j]);

end;

 

edit2.Text:=floattostr(max);

if (flag1 = 0) then

begin

m1:=m;

Stringgrid2.RowCount:=m;

Stringgrid2.Height:=17*m;

end;

flag1:=1;

 

for k:=0 to m do

begin

Stringgrid2.Cells[1,k]:=floattostr(C[k+1].baga);

Stringgrid2.Cells[0,k]:='C['+inttostr(C[k+1].i)+ ',' + inttostr(C[k+1].j)+']';

end;

for k:=m to Stringgrid2.RowCount-1 do

begin

Stringgrid2.Cells[1,k]:=' ';

Stringgrid2.Cells[0,k]:=' ';

end;

 

for i:=0 to n do

for j:=0 to n do

begin

if (a[i,j]= -1) then

begin

Stringgrid1.Cells[j,i]:='x';

end;

if (a[i,j]= -2) then

begin

Stringgrid1.Cells[j,i]:=' '

end;

if (a[i,j] >= 0) then

Stringgrid1.Cells[j,i]:=floattostr(a[i,j]);

 

end;

closefile(OUTF);

if (count = 0) then

Button1.Enabled:=false;

end;

 

procedure TForm1.Button2Click(Sender: TObject);

begin

Write_in_File();

end;

 

end.

 

 

 

 





:


: 2016-10-22; !; : 459 |


:

:

- - , .
==> ...

1472 - | 1469 -


© 2015-2024 lektsii.org - -

: 0.061 .