Advertisement
Saleh127

hackerearth Long ATM Queue

Sep 29th, 2020
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0);
  8. cin.tie(0);cout.tie(0);
  9.  
  10. ll a,c,d=1,e,fi,j,k,l;
  11. cin>>a;
  12. cin>>c;
  13. a-=1;
  14. while(a--)
  15. {
  16. cin>>e;
  17. if(e>=c)
  18. {
  19. c=e;
  20. }
  21. else
  22. {
  23. d++;
  24. c=e;
  25. }
  26. }
  27. cout<<d<<endl;
  28.  
  29. return 0;
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement