1.
, , :
1) ;
2) , .
.
2.
, , :
1) ;
2) , .
.
3.
, , :
1) ;
2) , .
, , - (, , ).
4.
, , :
1) ;
2) , .
, , . .
5.
, , :
1) ;
2) , .
, , [, b]. .
6.
, , :
1) ;
2) , .
, , , - .
7.
, , :
1) ;
2) , .
, , , - , .
8.
, , :
1) ;
2) , .
, , , - .
9.
, , :
1) ;
2) , .
|
|
, , , .
10.
, , :
1) ;
2) , , .
, , , - , .
11.
, , :
1) ;
2) , .
, , [, ]. .
12.
, , :
1) ;
2) , .
, , [, b], - .
13.
, , :
1) , ;
2) , .
.
14.
, , :
1) , ;
2) , . .
15.
, , :
1) , ;
2) , .
, , - (, , ).
16.
, , :
1) ;
2) , .
.
17.
, , :
1) ;
2) , , .
, , , - .
18.
, , :
1) , ;
2) , .
, , 20%, - .
19.
, , :
|
|
1) ;
2) , .
.
20.
, , :
1) ;
2) , .
, , , .
1. 1,...,n, n (n > 6). , 1,...,n.
: . 5.1.
. 5.1. - 1
Turbo Pascal :
Program ins_matrix;
Uses Crt;
Const n=10;
a: Array [l..n] of Real = _
(1,2,3,4,5,6,7,8,9,10);
Var x: Array [1..n, 1..n+1] of Real;
i:l..n; j:1..n+1;
Begin
For i:=l to n do
For j:=l to n do x [i,j]:=i/j;
For i:=1 to n do
Begin
For j:=n downto 6 do
x[i,j+1]:=x[i,j];
x[i,6]:=a[i];
End;
ClrScr;
For i:=l to n do
For j:=1 to n+1 do
Begin
If j=6
then TextColor(15)
Else TextColor(7);
GoToXY(j*6,i*2);
Write(x[i,j]:0:2)
End;
ReadLn;
End.
2. 57 .
: . . 5.2.
. 5.2. - 2
Turbo Pascal :
Program sort_matrix;
Uses crt;
Const
nrow = 5; ncol = 7;
Type
matr = array [1..nrow,1..ncol] of _ integer;
Var
a: matr;
sum: array [1..nrow] of longint;
i,j: integer; { }
nmin: integer;
{ }
b: integer;
{ }
s: longint;
Begin
ClrScr; Randomize;
For i:=l to nrow do
For j:=1 to ncol do
Begin
a[i,j]:=Random(100);
GoToXY(j*4,i); Write(a[i,j])
End;
For i:=1 to nrow do
begin
sum[i]:=0;
For j:=1 to ncol do
sum[i]:=sum[i] + a[i,j];
End;
{ }
For i:=1 to nrow-1 do
begin
nmin:=i;
For j:=i+1 to nrow do
If sum[j]<sum[nmin] then nmin:=j;
{ }
s:=sum[i];
sum[i]:=sum[nmin];
sum[nmin]:=s;
{ }
For j:=1 to ncol do
begin
b:=a[i,j];
a[i,j]:=a[nmin,j];
a[nmin,j]:=b;
End;
End;
{ }
For i:=l to nrow do
For j:=1 to ncol do
Begin
GoToXY(j*4,i);
Write(a[i,j])
End;
3. 9. , , , .
: , , . , , . . . 5.3.
Turbo Pascal :
Program max_diag;
Uses Crt;
Var a: Array [1..9,1..9] of Real;
max,sum: Real;
i,j: 1..9;
Begin
ClrScr; Randomize;
For i:=l to 9 do
For j:=1 to 9 do
begin
a[i,j]:=Random*100;
If j<i
then TextColor(11)
Else TextColor(15);
GotoXY(j*7,i*2);
Write(a[i,j]:2:2);
End;
max:=a[2,1];
|
|
For i:=3 to 9 do
For j:=l to i-1 do
If a[i,j]>max
then max:=a[i,j];
sum:=0;
For i:=l to 9 do
For j:=i to 9 do
If a[i,j]>max
then sum:=sum+a[i,j];
If sum=0
then
Write(' ':220)
Else
Write(' ':210,sum);
ReadLn;
End.
. 5.3. - 3