• 沒有找到結果。

Output For each line of input, output the largest integer which when divided into each of the input integers leaves the same remainder

N/A
N/A
Protected

Academic year: 2021

Share "Output For each line of input, output the largest integer which when divided into each of the input integers leaves the same remainder"

Copied!
1
0
0

加載中.... (立即查看全文)

全文

(1)

10407 Simple division

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.

Input

Each line of input contains a sequence of nonzero integer numbers sep- arated by a space. The last number on each line is 0 and this number does not belong to the sequence. There will be at least 2 and no more than 1000 numbers in a sequence; not all numbers occuring in a se- quence are equal. The last line of input contains a single 0 and this line should not be processed.

Output

For each line of input, output the largest integer which when divided into each of the input integers leaves the same remainder.

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

參考文獻

相關文件

[ Composite ] → Tree [ Composite ] receives a significance order of fields and classifies the input list first by the most significant field, and for each bucket classifies the

The method of least squares is a standard approach to the approximate solution of overdetermined systems, i.e., sets of equations in which there are more equations than unknowns.

• Suppose the input graph contains at least one tour of the cities with a total distance at most B. – Then there is a computation path for

In the second quarter of 2003, the average number of completed units in each building was 11, which was lower than the average value for 2002 (15 units). a The index of

More precisely, it is the problem of partitioning a positive integer m into n positive integers such that any of the numbers is less than the sum of the remaining n − 1

11[] If a and b are fixed numbers, find parametric equations for the curve that consists of all possible positions of the point P in the figure, using the angle (J as the

If he divided them equally into several groups, each group has the same number of pieces of blue paper and green paper respectively and no paper is

Then, it is easy to see that there are 9 problems for which the iterative numbers of the algorithm using ψ α,θ,p in the case of θ = 1 and p = 3 are less than the one of the