1. 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.
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.
решение:
95877/2= 47938(ост1)
47938/2=23968(ост0)
23968/2=11984(ост1)
11984/2=5992(ост0)
5992/2=2996(ост0)
2996/2=1498(ост0)
1498/2=749(ост0)
749/2=374(ост1)
374/2=187(ост0)
187/2=93(ост1)
93/2=46(ост1)
46/2=23(ост0)
23/2=11(ост1)
11/2=5(ост1)
5/2=2(ост1)
2/2=1(ост0)
1
2)147353=21111010112
решение :
147353/3=49117(ост2)
49117/3=16372(ост1)
16372/3=5457(ост1)
5457/3=1819(ост0)
1819/3=606(ост1)
606/3=202(ост0)
202/3=67(ост1)
67/3=22(ост1)
22/3=7(ост1)
7/3=2(ост1)
2
3)94649=10111000110111001
решение:
94649/2=47324(ост1)
47324/2=23662(ост0)
23662/2=11831(ост0)
11831/2=5915(ост1)
5915/2=2957(ост1)
2957/2=1478(ост1)
1478/2=739(ост0)
739/2=369(ост1)
369/2=184(ост1)
184/2=92(ост0)
92/2=46(ост0)
46/2=23(ост0)
23/2=11(ост1)
11/2=5(ост1)
5/2=2(ост1)
2/2=1(ост0)
1