{okomentuj ulohu 10, toto je prva varianta ulohy, pod nou je aj druha}
const max=100;
var a:array [1..max] of byte;
var i,dalsi,n,m,v:byte;
begin
write('Zadaj pocet deti: ');
readln(n);
write('Zadaj pocet deti, ktore maju vypadnut: ');
readln(v);
write('Zadaj rozpocitavacie cislo: ');
readln(m);
for i:=1 to n do a[i]:=i;
randomize;
dalsi:=random(n);i:=0;
repeat
if dalsi<n then inc(dalsi)
else dalsi:=1;
if a[dalsi]<>0 then inc(i);
if i=m then
begin
a[dalsi]:=0;
dec(v);
i:=0;
end;
until v=0;
writeln('Zostavaju: ');
for i:=1 to n do
if a[i]<>0 then write(a[i]:4);
readln;
end.
{druha varianta ulohy 10}
uses crt;
const max=100;
var a:array [1..max] of byte;
var i,dalsi,n,m,v:byte;
procedure vypis;
var i:byte;
begin
textcolor(15);
for i:=1 to n do
begin
gotoxy((i-1)*4+1,1);
if a[i]<>0 then write(a[i]:2)
else write(' ':2);
end;
writeln;
end;
begin
write('Zadaj pocet deti: ');
readln(n);
write('Zadaj pocet deti, ktore maju vypadnut: ');
readln(v);
write('Zadaj rozpocitavacie cislo: ');
readln(m);
for i:=1 to n do a[i]:=i;
clrscr;
vypis;
randomize;
dalsi:=random(n);i:=0;
repeat
if dalsi<n then inc(dalsi)
else dalsi:=1;
if a[dalsi]<>0 then
begin
inc(i);
gotoxy((dalsi-1)*4+1,1);
textcolor(green);
write(a[dalsi]:2);
if i<>m then readkey;
end;
if i=m then
begin
gotoxy((dalsi-1)*4+1,1);
textcolor(red);
write(a[dalsi]:2);
readkey;
a[dalsi]:=0;
dec(v);
i:=0;
vypis;
end;
until v=0;
writeln('Hotovo');
readln;
end.