Product of Two Numbers
Time limit2sMemory limit512 MB
Given a, b, c up to 1e6, choose positive A, B, C with A*B=C minimizing |A-a|+|B-b|+|C-c|.
- Level
Medium7 of 10
- Topics
- Math, Number theory, Brute force, Greedy
- Solved
- No attempts yet
Problem
You are given three integers , , . Among all positive integers , , with , find the smallest possible value of .
is the absolute value of .
Input
The first line contains , , separated by spaces. ()
Output
Print the minimum value of on the first line. must equal .