Advertisement
a53

foarfeca

a53
Feb 16th, 2022
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int n;
  7. cin>>n;
  8. int a[n+1];
  9. for(int i=1;i<=n;++i)
  10. cin>>a[i];
  11. int k=1;
  12. cout<<k<<' ';
  13. for(int i=2;i<=n;++i)
  14. if(a[i-1]+1==a[i])
  15. cout<<k<<' ';
  16. else
  17. ++k,cout<<k<<' ';
  18. cout<<'\n';
  19. return 0;
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement