Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<cmath>
- using namespace std;
- int main()
- {
- long long a=0, max=0, min=1000000000000;
- cin >> a;
- long long arr[a];
- for (int i=0; i<a; i++)
- cin >> arr[i];
- for (int i=0; i<a; i++)
- {
- if (arr[i]%2==0 && arr[i]>max)
- max = arr[i];
- if (arr[i]%2!=0 && arr[i]<min)
- min = arr[i];
- }
- if (min == 1000000000000)
- cout << -1 << " ";
- else cout << min << " ";
- if (max==0)
- cout << -1;
- else cout << max;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement