Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var
- a, b: array[1..10000] of Integer;
- min, max, i, n, k: Longint;
- begin
- min := 99999999;
- readln(n);
- for i := 1 to n do
- begin
- read(a[i]);
- inc(b[a[i]]);
- if a[i] < min then
- min := a[i];
- if a[i] > max then
- max := a[i];
- end;
- k := 5;
- while k > 0 do
- begin
- for i := min to max do
- while (b[i] > 0) and (k > 0) do
- begin
- dec(b[i]);
- dec(k);
- end;
- end;
- for i := 1 to n do
- if b[a[i]] > 0 then
- begin
- write(a[i],' ');
- dec(b[a[i]]);
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement