Advertisement
AquaBlitz11

TASK_050 - AquaBlitz11's Solution

Jan 7th, 2018
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n;
  8.     scanf("%d", &n);
  9.  
  10.     int mn = 1001, mx = 0;
  11.     for (int i = 0; i < n; ++i) {
  12.         int x;
  13.         scanf("%d", &x);
  14.         mn = min(mn, x);
  15.         mx = max(mx, x);
  16.     }
  17.  
  18.     printf("%d\n", mx-mn);
  19.  
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement