ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1131. Copying

Who can tell me why was I wrong?
Posted by qiurenhe 24 Jan 2003 18:40
var n,k,i,m:longint;
 begin
  readln(n,k);
  if k=1 then writeln(n-1)
  else begin
  n:=n-1; i:=0;m:=1;
  repeat
    if k>m then begin n:=n-m; m:=m shl 1;end
    else n:=n-k;
    inc(i);
  until n<1;
  writeln(i);end;
 end.