GO Solution For UVa 10407 - Simple division. In this post we will see how we can solve this challenge in GoLang for UVa Online Judge.

Problem Description

Integer division between a dividend n and a divisor d yields a quotient q and a remainder r. q is the integer which maximizes q ∗ d such that q ∗ d ≤ n and r = n− q ∗ d.

For any set of integers there is an integer d such that each of the given integers when divided by d leaves the same remainder.

...

You can find the full details of the problem Simple division at UVa Online Judge

Sample Input

701 1059 1417 2312 0
14 23 17 32 122 0
14 -22 17 -31 -124 0
0

Sample Output

179
3
3

Solution: Please check the main.go snippet for the solution.

Solution originally posted at: Github by @codingsince1985