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 1255. Graveyard of the Cosa Nostra

Why my programm is wrong ?
Posted by Aleksey S.S. 24 Mar 2003 11:29
>var n,k,ans1,ans2:longint;
>
>begin
>  read(n,k);
>  if n<k then write('0') else begin
>   ans1:=(n div k)*(n + n mod k);
>   ans2:=(n-k)*4;
>  if ans1>ans2 then write(ans1) else write(ans2); end;
>end.
I got AC !!!!!!!!!!!!!!!!!
Posted by Aleksey S.S. 25 Mar 2003 14:17
 My program is very short.
So what was the mistake after all?
Posted by ValBG 8 May 2003 03:34
My method is like yours and I can't find the bug in it. What was
wrong with yours?
Re: So what was the mistake after all?
Posted by MOPDOBOPOT (USU) 10 Oct 2012 18:31
For 8 3 answer is 21, not 20