Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n,a[1001],st,dr,lmax=0,ok=1;
- cin>>n;
- for(int i=1;i<=n;i++)
- {
- cin>>a[i];
- }
- for(int i=1;i<=n;i++)
- {
- for(int j=i;j<=n;j++)
- {
- ok=1;
- for(int k=i;k<=j-1;k++)
- {
- if(a[k]!=a[k+1])
- {
- ok=0;
- break;
- }
- }
- if(ok==1 && lmax<=j-i+1)
- {
- lmax=j-i+1;
- st=i;
- dr=j;
- }
- }
- }
- cout<<st<<" "<<dr;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement