Выделить из составного высказывания простые, обозначить их именами логических операций и выяснить истинное или ложное составное высказывание. "если лондон -столица германии,то неверно, что сша и китайитай расположены в азии " ,
procedure PrintMatrix(g: tmatr); var i, j: integer; begin for i := 1 to n do begin for j := 1 to n do Write(g[i, j]:4); Writeln end end;
procedure MakeMatrix(var a: tmatr); var i, j: integer; begin Randomize; for i := 1 to n do for j := 1 to n do a[i, j] := random(10) - 5; end;
var a: tmatr; i, j, k: integer;
begin MakeMatrix(a); Writeln('matrica A: '); PrintMatrix(a); k := 0; for i := 1 to n do for j := 2 to m-1 do if (a[i, j] < a[i, j+1]) and (a[i, j] > a[i, j-1]) then inc(k); Writeln('kolichestvo elementov = ', k); end.
Program samost; const n=5; m=5; type tmatr = array[1..n, 1..m] of integer; var a:tmatr; i,j,k:integer; procedure PrintMatrix(var g:tmatr); begin var i,j:integer; for i:=1 to n do begin for j:=1 to n do write(g[i,j]:4); writeln end; end; procedure MakeMatrix; begin var i,j,k:integer; randomize; for i:=1 to n do for j:=1 to n do begin a[i,j]:=random(10)-5; end; end; begin MakeMatrix; writeln('matrica A: '); PrintMatrix(a); k:=0; for i:=1 to n do for j:=2 to m-1 do begin
if (a[i,j]>a[i,j-1])and(a[i,j]<a[i,j+1]) then begin k:=k+1; ; writeln(i,j); end; end; writeln('kolichestvo elementov = ',k); end.
const
n = 5;
m = 5;
type
tmatr = array[1..n, 1..m] of integer;
procedure PrintMatrix(g: tmatr);
var
i, j: integer;
begin
for i := 1 to n do
begin
for j := 1 to n do Write(g[i, j]:4);
Writeln
end
end;
procedure MakeMatrix(var a: tmatr);
var
i, j: integer;
begin
Randomize;
for i := 1 to n do
for j := 1 to n do a[i, j] := random(10) - 5;
end;
var
a: tmatr;
i, j, k: integer;
begin
MakeMatrix(a);
Writeln('matrica A: ');
PrintMatrix(a);
k := 0;
for i := 1 to n do
for j := 2 to m-1 do
if (a[i, j] < a[i, j+1]) and (a[i, j] > a[i, j-1]) then inc(k);
Writeln('kolichestvo elementov = ', k);
end.
Тестовое решение:
matrica A:
4 4 0 -2 -3
1 -4 4 -5 0
2 4 -2 1 -2
-4 -5 -4 -2 4
1 0 0 -3 2
kolichestvo elementov = 2
const n=5;
m=5;
type tmatr = array[1..n, 1..m] of integer;
var a:tmatr;
i,j,k:integer;
procedure PrintMatrix(var g:tmatr);
begin
var i,j:integer;
for i:=1 to n do
begin
for j:=1 to n do
write(g[i,j]:4);
writeln
end;
end;
procedure MakeMatrix;
begin
var i,j,k:integer;
randomize;
for i:=1 to n do
for j:=1 to n do
begin
a[i,j]:=random(10)-5;
end;
end;
begin
MakeMatrix;
writeln('matrica A: ');
PrintMatrix(a);
k:=0;
for i:=1 to n do
for j:=2 to m-1 do
begin
if (a[i,j]>a[i,j-1])and(a[i,j]<a[i,j+1]) then
begin
k:=k+1; ;
writeln(i,j);
end;
end;
writeln('kolichestvo elementov = ',k);
end.