#include<cstdio>
#include<algorithm>
using namespace std;
int gcd(int a, int b){
return b == 0 ? a : gcd(b, a % b);
}
int main(){
int n, X; scanf("%d %d", &n, &X);
int x; scanf("%d", &x);
int res = abs(X - x);
for(int i = 1; i < n; i++){
scanf("%d", &x);
res = gcd(res, abs(X - x));
}
printf("%d\n", res);
return 0;
}
./Main.cpp: In function ‘int main()’:
./Main.cpp:11:34: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
int n, X; scanf("%d %d", &n, &X);
^
./Main.cpp:12:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
int x; scanf("%d", &x);
^
./Main.cpp:15:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &x);
^