#include <iostream>
#include<math.h>
using namespace std;
int main()
{
int n;
cin >> n;
int data[n];
for (int i = 0;i < n;i++)
cin >> data[i];
int differ =abs( data[0]-data[1]);
int max = data[0], min = data[1];
for (int i = 0;i < n;i++)
{
for (int j = i + 1;j < n;j++)
{
if (abs(data[i] - data[j]) < differ)
{
differ = abs(data[i] - data[j]);
}
}
}
cout << differ;
}
20171201---最小差值
最新推荐文章于 2022-04-30 22:59:46 发布