本文共 308 字,大约阅读时间需要 1 分钟。
思路:排序一下,维护相邻两项差的最小值
#includeusing namespace std;typedef long long ll;const int N=1e6+5;const ll mod=1e9+7;int main(){ int n;cin>>n; vector a; for(int i=1;i<=n;i++){ int x;cin>>x; a.push_back(x); } sort(a.begin(),a.end()); int mi=1e9; for(int i=1;i
转载地址:http://huhwk.baihongyu.com/