|
|
back to board>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. 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 |
|
|