T3000

Untitled

Sep 7th, 2022
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. using ll = long long;
  5. using ld = long double;
  6.  
  7. int main()
  8. {
  9.     ll c = 1;
  10.     while (true)
  11.     {
  12.         ll n;
  13.         cin >> n;
  14.         ll min = 1e9;
  15.         ll max = -1e9;
  16.         while (n-- > 0)
  17.         {
  18.             ll a;
  19.             cin >> a;
  20.             if (a > max)
  21.             {
  22.                 max = a;
  23.             }
  24.             if (a < min)
  25.             {
  26.                 min = a;
  27.             }
  28.         }
  29.         cout << "Case " << c << ": " << min << " " << max << " " << max - min << endl;
  30.         c++;
  31.     }
  32.  
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment