|
|
back to boardWhy my programm is wrong ? >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 !!!!!!!!!!!!!!!!! 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? For 8 3 answer is 21, not 20 |
|
|