var array -2 1000 of integer max min integer begin read for to do begi

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
var a: array[-2..1000] of integer;
i, j, n, max, min: integer;
begin
read(n);
for i := 0 to n - 1 do begin
read(a[i]);
if (i = 1) then begin
max := a[i];
min := a[i];
end
else begin
if (max < a[i]) then
max := a[i];
if (min > a[i]) then
min := a[i];
end;
end;
a[-2] := min;
a[-1] := a[0];
a[0] := max;
writeln(min);
writeln(max);
for i := -2 to n - 1 do
write(a[i], ' ');
end.
_____
var a: array[0..100, 0..100] of integer;
i, j, minSum, minSumInd, curSum, n, m: integer;
begin
read(n);
read(m);
minSum := MaxInt;
minSumInd := 0;
for i := 0 to n - 1 do begin
curSum := 0;
for j := 0 to m - 1 do begin
read(a[i ,j]);
if (a[i, j] mod 5 = 0) then
curSum := curSum + a[i, j];
end;
if (minSum > curSum) then begin
minSumInd := i;
minSum := curSum;
end;
end;
for i := 0 to n - 1 do begin
if (i <> minSumInd) then begin
for j := 0 to m - 1 do
write(a[i, j], ' ');
end;
writeln();
end;
end.