import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
StringBuffer sb = new StringBuffer("");
String m = "";
while ((m = br.readLine()) != null) {
if("0".equals(m))
break;
String[] str = m.split(" ");
int[] x=new int[str.length-1];
int min=Integer.MAX_VALUE;
for(int i=0;i<x.length;i++){
x[i]=Integer.parseInt(str[i]);
if(x[i]<min)
min=x[i];
}
for(int i=0;i<x.length;i++){
x[i]-=min;
}
int result=0;
for(int i=0;i<x.length;i++){
result=gcd(result,x[i]);
}
sb.append(result).append("\n");
}
System.out.print(sb);
}
static int gcd(int a, int b) {
if (b == 0) {
return a;
}
return gcd(b, a % b);
}
}
Hi! I am very interested in if you have a lot of traffic on your blog?
ReplyDeleteYes i have a lot of traffic on my blog. :)
Delete