Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int a,b,max_num,min_num,counter = 0;
  6. cin>>a;
  7. for(int i=1;i<=a;i++)
  8. {
  9. cin>>b;
  10. if(i == 1)
  11. {
  12. max_num = b;
  13. min_num = b;
  14. }
  15. if(i > 1)
  16. {
  17. if(b < min_num)
  18. {
  19. min_num = b;
  20. counter++;
  21. }
  22. if(b > max_num)
  23. {
  24. max_num = b;
  25. counter++;
  26. }
  27. }
  28.  
  29. }
  30.  
  31. cout<<counter<<endl;
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement