You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
399 B
20 lines
399 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
int main() {
|
|
int n;
|
|
cin >> n;
|
|
int a[1000];
|
|
for (int i = 0; i < n; i++) {
|
|
cin >> a[i];
|
|
}
|
|
int m = INT32_MAX;
|
|
for (int i = 0; i < n - 1; i++) {
|
|
for (int j = i + 1; j < n; j++) {
|
|
if (abs(a[j] - a[i]) < m)m = abs(a[j] - a[i]);
|
|
}
|
|
}
|
|
cout << m << endl;
|
|
return 0;
|
|
} |