提交时间:2023-10-30 21:07:40

运行 ID: 29522

#include <bits/stdc++.h> using namespace std; int a[10001]; int main(){ int n, max = -10000, min = 10000; cin >> n; for(int i = 1; i <= n; i++){ cin >> a[i]; } for(int i = 1; i <= n; i++){ if(a[i] > max){ max = a[i]; } if(a[i] < min){ min = a[i]; } } cout << max - min; return 0; }