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

OH NO! WA#3 AGAIN! My alg is so clear. Please look over my code or give some tests.
Posted by Akshin Salimov 14 Apr 2005 00:32
Here is my code:

var
  i,hh,s,n,k:longint;

begin
  readln(n,k);
  if (n=1) or (n=0) then
  begin
    writeln(0);
    halt(1);
  end;
  if n>k then
  begin
  s:=1; i:=0; hh:=0;
  while (s<k) do
  begin
    inc(i);
    s:=s+i;
    inc(hh);
  end;
  hh:=hh+(n-s) div k;
  if (n-s) mod k<>0 then inc(hh);
  writeln(hh);
  end else writeln(1);
end.

Edited by author 14.04.2005 00:32
Read a condition more closely :)
Posted by Виктор Крупко 14 Apr 2005 01:17
test:
 1) 3 3
    2
 2) 5 7
    3
 3) 4 2
    2
Re: Read a condition more closely :)
Posted by Akshin Salimov 14 Apr 2005 15:24
I modified my program and it gives correct answer for tests, you gave to me, but now I got WA#4!!! Here is my code

[code deleted]

Edited by author 14.04.2005 15:25

Edited by moderator 24.11.2019 13:04
Re: Read a condition more closely :)
Posted by Akshin Salimov 14 Apr 2005 16:02
Thank you very much!
I found my mistake and I've got AC!
You helped me a lot!
Thanks to Allah!