Advertisement
Guest User

secvegale2

a guest
Feb 22nd, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int n,i, v[1005];
  6. int k, j, o, si, sj, nr=0 ;
  7. int main()
  8. {
  9. cin>>n;
  10. for(i=1;i<=n;i++)
  11. cin>>v[i];
  12.  
  13. for(i=1;i<=n;i++)
  14. {
  15. for(j=i;j<=n;j++)
  16. {
  17. for(o=i;o<=j;o++)
  18. if(v[o]!=v[i])
  19. break;
  20. if(o==j+1)
  21. nr++;
  22.  
  23. }
  24. }
  25.  
  26. cout<< nr << '\n';
  27.  
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement