上AC代码 11行!!! #include <bits/stdc++.h> using namespace std; int main() { int n , k; cin >> n >> k; vector<int> a(n); for(int i = 0 ; i <= n - 1 ; ++ i) cin >> a[i]; sort(a.begin() , a.end()); cout << (abs(a[0] - a[n - 1])> k ? a[n - 1] : a[n - 2...