'commit'
This commit is contained in:
20
TangDou/XiTi/1321.cpp
Normal file
20
TangDou/XiTi/1321.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user