PROBLEM STATEMENT
Krolik found a sheet of paper with an equation containing three positive integers:
"a * b = c".
This equation might be wrong,
so Krolik is trying to make it correct by adjusting the numbers a, b, and c.
You are given three ints a, b, and c.
Return a long long containing the minimum value of |A - a| + |B - b| + |C - c|,
where A, B, and C are positive integers satisfying A * B = C.
DEFINITION
Class:CorrectMultiplication
Method:getMinimum
Parameters:int, int, int
Returns:long long
Method signature:long long getMinimum(int a, int b, int c)
NOTES
-|x| is the absolute value of x (which is x for non-negative x and (-x) for negative x).
CONSTRAINTS
-a, b, and c will each be between 1 and 1,000,000,000, inclusive.
EXAMPLES
0)
19
28
522
Returns: 2
By assigning A = 18, B = 29, and C = 522 the value of |A - a| + |B - b| + |C - c| is minimized.
1)
10
30
500
Returns: 11
2)
11111
11111
123454321
Returns: 0
3)
1000
100
10
Returns: 1089
Note that A, B, and C must be positive integers.
4)
399
522
199999
Returns: 24
This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2010, TopCoder, Inc. All rights reserved.