SHARE
TWEET

secvegale2

a guest Feb 22nd, 2020 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top