|
|
back to boardOH NO! WA#3 AGAIN! My alg is so clear. Please look over my code or give some tests. 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 :) test: 1) 3 3 2 2) 5 7 3 3) 4 2 2 Re: Read a condition more closely :) 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 :) Thank you very much! I found my mistake and I've got AC! You helped me a lot! Thanks to Allah! |
|
|