У Веры Полины Сони и Кати следующие фамилии Ветрова Петрова Сидорова и Куликова. Известно, что Вера и Сидорова - отличницы. Полина и Ветрова троечницы. Ветрова ростом выше чем Петрова. А катя ростом ниже Петровой. Соня и Полина имеют одинаковый рост. Найдите фамилию каждой
var a:array [1..4, 1..4] of integer; i, j, max: integer;
Begin
for i := 1 to 4 do
begin
for j := 1 to 4 do
read(a[i][j]);
readln;
end;
max := a[1][1];
for i := 2 to 4 do
if max < a[i][i] then max := a[i][i];
writeln(max);
End.
2.
var a:array [1..5, 1..5] of integer; i, j, m, sum: integer;
Begin
for i := 1 to 5 do
begin
for j := 1 to 5 do
read(a[i][j]);
readln;
end;
readln(m);
sum := 0;
for i := 1 to 5 do
if (m - i > 0) and (m - i < 6) then
sum := sum + a[i][m - i];
writeln(sum);
End.
3.
Const N = 5;
var a:array [1..N, 1..N] of integer; i, j, max: integer;
Begin
for i := 1 to N do
begin
for j := 1 to N do
read(a[i][j]);
readln;
end;
max := a[1][N];
for i := 2 to N do
if (max < a[i][N + 1 - i]) then
max := a[i][N + 1 - i];
writeln(max);
End.
4.
Const N = 5;
var a:array [1..N, 1..N] of integer; i, j, count: integer; sum: real;
Begin
for i := 1 to N do
begin
for j := 1 to N do
read(a[i][j]);
readln;
end;
sum := 0;
count := 0;
for i := 1 to N do
if (a[5][i] mod 2 = 1) then
begin
sum := sum + a[5][i];
inc(count);
end;
sum := sum / count;
writeln(sum);
End.
5.
var a:array [1..4, 1..4] of integer; i, j, upper_sum, lower_sum: integer;
Begin
for i := 1 to 4 do
begin
for j := 1 to 4 do
read(a[i][j]);
readln;
end;
upper_sum := 0;
lower_sum := 0;
for i := 1 to 4 do
begin
for j := i + 1 to 4 do
upper_sum := upper_sum + a[i][j];
for j := 1 to i - 1 do
lower_sum := lower_sum + a[i][j];
end;
writeln(upper_sum);
writeln(lower_sum);
End.
var
A:array[0..7,0..13] of integer;
B:array[0..255] of integer;
i,j,k:byte;
s:integer;
SR:real;
begin
randomize;
s:=0;
k:=0;
for i:=0 to 7 do
begin
for j:=0 to 13 do
begin
A[i,j]:=random(20);
write(A[i,j]:4);
if A[i,j] mod 2<>0
then
begin
S:=S+A[i,j];
k:=k+1;
end;
end;
writeln;
end;
SR:=S/k;
k:=0;
writeln;
for i:=0 to 7 do
for j:=0 to 13 do
if (A[i,j] mod 2=0) and (A[i,j]>SR)
then
begin
k:=k+1;
B[k]:=A[i,j];
write(b[k]:4);
end;
end.
2.
var
A:array[0..9,0..9] of integer;
B:array[0..255,0..1] of integer;
i,j,k:byte;
s,ss,MIN:integer;
FLAG:boolean;
begin
randomize;
s:=0;
k:=0;
for i:=0 to 9 do
begin
for j:=0 to 9 do
begin
A[i,j]:=random(20);
write(A[i,j]:4);
B[i,0]:=A[i,j]+B[i,0];
B[i,1]:=i;
end;
writeln;
end;
writeln;
FLAG:=false;
MIN:=10*20+1;
for i:=0 to 9 do
begin
for j:=i to 9 do
if MIN>B[j,0]
then
begin
Min:=B[j,0];
k:=j;
FLAG:=true;
end;
if FLAG
then
begin
S:=B[i,0]; //замена
SS:=B[i,1];
B[i,0]:=B[k,0];
B[i,1]:=B[k,1];
B[k,0]:=S;
B[k,1]:=SS;
FLAG:=false;
MIN:=10*20+1;
end;
end;
for i:=0 to 9 do
begin
writeln;
for j:=0 to 9 do
write(A[B[i,1],j]:4);
end;
end.