program rrr; uses crt; const n=9; type massiv=array[1..n]of real; var a:massiv; max,sr:integer; procedure vvod(var x:massiv); var i:integer; begin writeln('wwedite massiv'); for i:=1 to n do readln(x[i]); end; procedure vivod(x:massiv); var i:integer; begin for i:=1 to n do write(x[i]:6:2,' '); end; procedure sred_ar_i_max(x:massiv,var sr,max:real); var sum:real; i:integer; begin s:=0; for i:=1 to n do if x[i]>0 then s:=s+x[i]; end; sr:=s/n; for i:=1 to n do if (x[i]>0) and max<x[i] then max:=x[i]; end; vvod(a); clrscr; vivod(a); sred_ar_i_max(a,sr,max); writeln('max=',max:6:2,'srednee arifmet=',sr:6:2); readln; end.
type Oras = (Chisinau, Orhei, Balti, Tigina, Tiraspol); Zi = (L, Ma, Mi, J, V, S, D); Consum = array [Oras, Zi] of real; var C : Consum; r : Oras; z : Zi; i,k : integer; sum,min_r,max_r,min_z,max_z:real; n_max_r,n_min_r,n_max_z,n_min_z:integer; begin r:=Chisinau; randomize; for i:=1 to 5 do begin z:=L; for k:=1 to 7 do begin c[r,z]:=random*100; z:=succ(z); end; r:=succ(r); end; r:=Chisinau; for i:=1 to 5 do begin z:=L; case ord(r) of 0:writeln('Chisinau'); 1:writeln('Orhei'); 2:writeln('Balti'); 3:writeln('Tigina'); 4:writeln('Tiraspol'); end; for k:=1 to 7 do begin write(c[r,z]:6:2); z:=succ(z); end; r:=succ(r); writeln; end; writeln('Vsego za nedelu'); r:=Chisinau; min_r:=99999; max_r:=0; n_min_r:=-1; n_max_r:=-1; for i:=1 to 5 do begin z:=L; case ord(r) of 0:write('Chisinau sum='); 1:write('Orhei sum='); 2:write('Balti sum='); 3:write('Tigina sum='); 4:write('Tiraspol sum='); end; sum:=0; for k:=1 to 7 do begin sum:=sum+c[r,z]; z:=succ(z); end; if sum>max_r then begin max_r:=sum; n_max_r:=ord(r); end; if sum<min_r then begin min_r:=sum; n_min_r:=ord(r); end;
for k:=1 to 7 do begin r:=Chisinau; case ord(z) of 0:write('L sum='); 1:write('Ma sum='); 2:write('Mi sum='); 3:write('J sum='); 4:write('V sum='); 5:write('S sum='); 6:write('D sum='); end; sum:=0; for i:=1 to 5 do begin sum:=sum+c[r,z]; r:=succ(r); end; if sum>max_z then begin max_z:=sum; n_max_z:=ord(z); end; if sum<min_z then begin min_z:=sum; n_min_z:=ord(z); end; z:=succ(z); writeln(sum:8:2); end; writeln('Gorod c maximalnim potrebleniem'); r:=Chisinau; for i:=1 to 5 do begin if ord(r)=n_max_r then case ord(r) of 0:writeln('Chisinau'); 1:writeln('Orhei'); 2:writeln('Balti'); 3:writeln('Tigina'); 4:writeln('Tiraspol'); end; r:=succ(r); end; writeln('Gorod c minimalnim potrebleniem'); r:=Chisinau; for i:=1 to 5 do begin if ord(r)=n_min_r then case ord(r) of 0:writeln('Chisinau'); 1:writeln('Orhei'); 2:writeln('Balti'); 3:writeln('Tigina'); 4:writeln('Tiraspol'); end; r:=succ(r); end;
writeln('Den c maximalnim potrebleniem'); z:=L; for k:=1 to 7 do begin if ord(z)=n_max_z then case ord(z) of 0:writeln('L'); 1:writeln('Ma'); 2:writeln('Mi'); 3:writeln('J'); 4:writeln('V'); 5:writeln('S'); 6:writeln('D'); end; z:=succ(z); end; writeln('Den c minimalnim potrebleniem'); z:=L; for k:=1 to 7 do begin if ord(z)=n_min_z then case ord(z) of 0:writeln('L'); 1:writeln('Ma'); 2:writeln('Mi'); 3:writeln('J'); 4:writeln('V'); 5:writeln('S'); 6:writeln('D'); end; z:=succ(z); end;
program rrr;
uses crt;
const n=9;
type massiv=array[1..n]of real;
var a:massiv;
max,sr:integer;
procedure vvod(var x:massiv);
var i:integer;
begin
writeln('wwedite massiv');
for i:=1 to n do
readln(x[i]);
end;
procedure vivod(x:massiv);
var i:integer;
begin
for i:=1 to n do
write(x[i]:6:2,' ');
end;
procedure sred_ar_i_max(x:massiv,var sr,max:real);
var sum:real; i:integer;
begin
s:=0;
for i:=1 to n do
if x[i]>0 then s:=s+x[i];
end;
sr:=s/n;
for i:=1 to n do
if (x[i]>0) and max<x[i] then max:=x[i];
end;
vvod(a);
clrscr;
vivod(a);
sred_ar_i_max(a,sr,max);
writeln('max=',max:6:2,'srednee arifmet=',sr:6:2);
readln;
end.
type Oras = (Chisinau, Orhei, Balti, Tigina, Tiraspol);
Zi = (L, Ma, Mi, J, V, S, D);
Consum = array [Oras, Zi] of real;
var C : Consum;
r : Oras;
z : Zi;
i,k : integer;
sum,min_r,max_r,min_z,max_z:real;
n_max_r,n_min_r,n_max_z,n_min_z:integer;
begin
r:=Chisinau;
randomize;
for i:=1 to 5 do
begin
z:=L;
for k:=1 to 7 do
begin
c[r,z]:=random*100;
z:=succ(z);
end;
r:=succ(r);
end;
r:=Chisinau;
for i:=1 to 5 do
begin
z:=L;
case ord(r) of
0:writeln('Chisinau');
1:writeln('Orhei');
2:writeln('Balti');
3:writeln('Tigina');
4:writeln('Tiraspol');
end;
for k:=1 to 7 do
begin
write(c[r,z]:6:2);
z:=succ(z);
end;
r:=succ(r);
writeln;
end;
writeln('Vsego za nedelu');
r:=Chisinau;
min_r:=99999;
max_r:=0;
n_min_r:=-1;
n_max_r:=-1;
for i:=1 to 5 do
begin
z:=L;
case ord(r) of
0:write('Chisinau sum=');
1:write('Orhei sum=');
2:write('Balti sum=');
3:write('Tigina sum=');
4:write('Tiraspol sum=');
end;
sum:=0;
for k:=1 to 7 do
begin
sum:=sum+c[r,z];
z:=succ(z);
end;
if sum>max_r then
begin
max_r:=sum;
n_max_r:=ord(r);
end;
if sum<min_r then
begin
min_r:=sum;
n_min_r:=ord(r);
end;
r:=succ(r);
writeln(sum:8:2);
end;
writeln('Po dnyam nedeli');
z:=L;
min_z:=99999;
max_z:=0;
n_min_z:=-1;
n_max_z:=-1;
for k:=1 to 7 do
begin
r:=Chisinau;
case ord(z) of
0:write('L sum=');
1:write('Ma sum=');
2:write('Mi sum=');
3:write('J sum=');
4:write('V sum=');
5:write('S sum=');
6:write('D sum=');
end;
sum:=0;
for i:=1 to 5 do
begin
sum:=sum+c[r,z];
r:=succ(r);
end;
if sum>max_z then
begin
max_z:=sum;
n_max_z:=ord(z);
end;
if sum<min_z then
begin
min_z:=sum;
n_min_z:=ord(z);
end;
z:=succ(z);
writeln(sum:8:2);
end;
writeln('Gorod c maximalnim potrebleniem');
r:=Chisinau;
for i:=1 to 5 do
begin
if ord(r)=n_max_r then
case ord(r) of
0:writeln('Chisinau');
1:writeln('Orhei');
2:writeln('Balti');
3:writeln('Tigina');
4:writeln('Tiraspol');
end;
r:=succ(r);
end;
writeln('Gorod c minimalnim potrebleniem');
r:=Chisinau;
for i:=1 to 5 do
begin
if ord(r)=n_min_r then
case ord(r) of
0:writeln('Chisinau');
1:writeln('Orhei');
2:writeln('Balti');
3:writeln('Tigina');
4:writeln('Tiraspol');
end;
r:=succ(r);
end;
writeln('Den c maximalnim potrebleniem');
z:=L;
for k:=1 to 7 do
begin
if ord(z)=n_max_z then
case ord(z) of
0:writeln('L');
1:writeln('Ma');
2:writeln('Mi');
3:writeln('J');
4:writeln('V');
5:writeln('S');
6:writeln('D');
end;
z:=succ(z);
end;
writeln('Den c minimalnim potrebleniem');
z:=L;
for k:=1 to 7 do
begin
if ord(z)=n_min_z then
case ord(z) of
0:writeln('L');
1:writeln('Ma');
2:writeln('Mi');
3:writeln('J');
4:writeln('V');
5:writeln('S');
6:writeln('D');
end;
z:=succ(z);
end;
readln;
end.