Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n;
- scanf("%d", &n);
- int mn = 1001, mx = 0;
- for (int i = 0; i < n; ++i) {
- int x;
- scanf("%d", &x);
- mn = min(mn, x);
- mx = max(mx, x);
- }
- printf("%d\n", mx-mn);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement