denis_andrei10

nrde3cifre

Oct 29th, 2019
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include<iostream>
  2. #include<climits>
  3. using namespace std;
  4. int main()
  5. {
  6.     int n, x, i, pc, minim=INT_MAX, maxim=INT_MIN;
  7.     cin>>n;
  8.     for(i=1; i<=n; i++)
  9.     {
  10.         cin>>x;
  11.         pc=x/100%10;
  12.         if(pc<minim || pc==minim && x>maxim)
  13.         {
  14.             minim=pc;
  15.             maxim=x;
  16.         }
  17.     }
  18.     cout<<maxim;
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment