Odpowiedzi

Najlepsza Odpowiedź!
2010-01-17T11:10:33+01:00
Program przyklad;

const min = 1;
const max = 99;
const N = 100;

var
t : array[1..N] of integer;
tw : array[min..max] of integer;
i,j : integer;

begin
randomize;
for i := 1 to N do t[i] := min + random(max - min + 1);
for i := 1 to N do write(t[i]:4);
writeln;
for i := min to max do tw[i] := 0;
for i := 1 to N do inc(tw[t[i]]);
j := 1;
for i := min to max do
while tw[i] > 0 do
begin
t[j] := i; inc(j); dec(tw[i]);
end;
writeln;
for i := 1 to N do write(t[i]:4);
readln;
end.