Advertisement
Guest User

pt prostu de bunta

a guest
Jan 27th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int i,n,v[1001],x,x1,ok;
  4. int main()
  5. {
  6. cin>>n;
  7. for (i=1;i<=n;i++)
  8. {
  9. cin>>x;
  10. if (x<1000)
  11. v[x]=1;
  12. }
  13. x=0;
  14. x1=0; ok=0;
  15. for (i=999;i>=100 && !ok;i--)
  16. {
  17. if (v[i]==0 && !x)
  18. x=i;
  19. else
  20. if (v[i]==0 && x)
  21. {
  22. ok=1;
  23. x1=i;
  24. }
  25. }
  26. if (!x || !x1)
  27. cout<<"NU EXISTA";
  28. else
  29. cout<<x1<<" "<<x;
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement