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

Var
  N, K                : LongInt;
begin
  Readln(N, K);
  WriteLn((Sqr(N)-Sqr(N Mod K)) Div K);
end.
 isn`t answer of
7 4
--->
10?

aidin_n7@hotmail.com
But it is wrong, indeed.
Look at the following sample - 5 3
What is the answer? 7? No, it's 8!

1 1 1 2 3
4 4 4 2 3
5 6 * 2 3
5 6 7 7 7
5 6 8 8 8
Gheorghe Stefan // Problem 1255. Graveyard of the Cosa Nostra 18 Mar 2003 21:20
Your formula don't work with 5 3. The answer is 8 like this:

1 1 1 3 4   but your program outputs (25 - 4) / 3 = 7
2 2 2 3 4
5 6 0 3 4
5 6 7 7 7
5 6 8 8 8

:)