nicuvlad76

Untitled

Jan 30th, 2021
954
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. ///525- vector carcateristic
  4. int fr[1000]= {0} ;///0..999
  5.               int x,i,n;
  6. int a=-1,b=-1;
  7.  
  8. int main()
  9. {
  10.   ///citire
  11.   cin>>n;
  12.   for(i=1; i<=n; i++)
  13.   {
  14.     cin>>x;
  15.     if(x<1000)fr[x]=1;
  16.   }
  17.   ///prelucrare
  18.   for(i=999; i>=100 && a==-1; --i)
  19.     if(fr[i]==0)
  20.     {
  21.       if(b==-1) b=i;
  22.       else if(a==-1)a=i;
  23.     }
  24.    ///afisare
  25.    if(a==-1) cout<<"NU EXISTA";
  26.    else cout<<a<<' '<<b;
  27.   return 0;
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment