Raslboyy

Untitled

Apr 19th, 2020
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <iostream>
  2. #include <bits/stdc++.h>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     int n;
  8.     cin >> n;
  9.     int mn = INT_MAX, mx = INT_MIN;
  10.     for (int i = 0; i < n; i++){
  11.         int a;
  12.         cin >> a;
  13.         if (a > 0 && a % 2 == 0)
  14.             mn = min(mn, a), mx = max(mx, a);
  15.     }
  16.     if (mx == INT_MIN)
  17.         cout << "Not found\n";
  18.     else
  19.         cout << mx << " " << mn << "\n";
  20.    
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment