Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.26 KB | None | 0 0
  1. var a:array [1..500] of byte; i,j,n,k,l:integer;
  2. begin
  3. readln(n,k);
  4. j:=n;i:=0;
  5. while j<>1 do begin
  6.     if l=k then
  7.         if a[i]=0 then begin a[k]:=1; l:=0;j:=j-1;end
  8.     else if a[i]=0 then inc(l);inc(i);end;
  9. for i:=1 to n do if a[i]=0 then writeln(i);
  10. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement