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

Aleksey S.S. Why my programm is wrong ? [3] // Problem 1255. Graveyard of the Cosa Nostra 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.
Aleksey S.S. I got AC !!!!!!!!!!!!!!!!! [2] // Problem 1255. Graveyard of the Cosa Nostra 25 Mar 2003 14:17
 My program is very short.
My method is like yours and I can't find the bug in it. What was
wrong with yours?
For 8 3 answer is 21, not 20