Results 1 to 3 of 3
Hybrid View
-
27th August 2009 12:46 #1
7. [10,10] B[12,12]. [-500 - 500]. :
, - ; - - N;
procedure moveMin(var a: matrix; size, M, N: integer; var max, min: integer);
var
i, j, minIndex, maxIndex, temp: integer;
begin
max := 0;
min := 0;
for i := 1 to size do
begin
minIndex := 1;
for j := 2 to size do
if a[i, j] < a[i, minIndex] then
minIndex := j;
if a[i, minIndex] < N then
min := min + 1;
if minIndex > 1 then
begin
temp := a[i, minIndex];
for j := minIndex downto 2 do
a[i, j] := a[i, j - 1];
a[i, 1] := temp;
end;
maxIndex := 1;
for j := 2 to size do
if a[i, j] > a[i, maxIndex] then
maxIndex := j;
if a[i, maxIndex] > M then
max := max + 1;
if maxIndex < size then
begin
temp := a[i, maxIndex];
for j := maxIndex to size - 1 do
a[i, j] := a[i, j + 1];
a[i, size] := temp;
end;
end;
end;
?
-
27th August 2009 21:58 #2Registered User
Join Date: Dec:2007
Location: Sofia
Posts: 366
? ? ? ?
-
27th August 2009 22:43 #3Registered User
Join Date: Oct:2006
Location: Plovdiv
Posts: 305
. - , - - 1 1 15
prepBut nI vrbLike adjHungarian! qWhat's artThe adjBig nProblem?




Reply With Quote
Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in