Advertisement
Guest User

Untitled

a guest
Oct 20th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int n,i,v[900],nr,max, a = -1, b = -1;
  6. cin>>n;
  7. for(i=0;i<900;i++)
  8. v[i]=0;
  9. for(i=0;i<n;i++) {
  10. cin>>nr;
  11. if(nr>99 && nr <1000)
  12. v[nr-100]++;
  13. }
  14. for (i = 899; i >= 0; i--) {
  15. if (a != -1 && b != -1)
  16. break;
  17.  
  18. if (a == -1 && v[i] == 0) {
  19. a = i + 100;
  20. continue;
  21. }
  22.  
  23. if (b == -1 && v[i] == 0)
  24. b = i + 100;
  25. }
  26.  
  27. if (a == -1 || b == -1)
  28. cout << "NU EXISTA";
  29. else
  30. cout << b << ' ' << a;
  31.  
  32.  
  33. return 0;
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement