DMOPC '19 Contest 1 P0 - Range Finding
Source Code
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, l = 0, s = 1000000, t;
cin >> n;
for(int i = 0; i < n; i++){
cin >> t;
if(t > l){
l = t;
}else if(t < s){
s = t;
}
}
cout << l - s;
return 0;
}