Nathan Coulas

DMOPC '19 Contest 1 P0 - Range Finding

dmopc19c1p0 CPP17 04 May, 2020 0.416s 3 points

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;
}