thecodecird

Easy Arrays

Sep 27th, 2021
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. #include "bits/stdc++.h"
  2.  
  3. #define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
  4.  
  5. #define ll long long int
  6.  
  7. #define pb push_back
  8.  
  9. #define f(a) for(ll i = 0;i<a;i++)
  10.  
  11. #define ffor(i,a,b) for(ll i = a;i<b;i++)
  12.  
  13. #define rfor(i,a,b) for(ll i = a;i>b;i--)
  14.  
  15. #define T ll t; cin>>t; while(t--)
  16.  
  17. #define MOD 1000000007
  18.  
  19. using namespace std;
  20.  
  21. int main()
  22.  
  23. {
  24.  
  25.     faster
  26.  
  27.         ll n;
  28.  
  29.         cin>>n;
  30.  
  31.         ll maximum=-INF;
  32.  
  33.         ll minimum=INF;
  34.  
  35.         f(n)
  36.  
  37.         {
  38.             ll x;
  39.  
  40.             cin>>x;
  41.  
  42.             minimum=min(x,minimum);
  43.  
  44.             maximum=max(x,maximum);
  45.  
  46.         }
  47.  
  48.         cout<<abs(minimum-maximum)<<"\n";
  49.  
  50. }
Advertisement
Add Comment
Please, Sign In to add comment