思路 签到题 AC代码 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN = 1e5 + 5; ll a[MAXN]; void solve() { int n; scanf("%d", &n); for (int i = 0; i < n; ++i) { scanf("%lld", &a[i]); } sort(a, a + n); printf("%lld", a[n - 1] - a[0]); } int main() { solve(); return 0; }