1 solutions

  • 0
    @ 2025-11-5 18:31:31

    C++ :

    
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int a[100005]={0},n,c=1,d=1;
    	cin>>n;
    	for(int i=1;i<=n;i++)
    	{
    		cin>>a[i];
    	}
    	for(int i=2;i<=n;i++)
    	{
    	if(a[i]==a[i-1]){
    		c++; 
    	 }
    	 else
    	 {
       	  c=1;
    	 }
    	 if(c>=d){
    	 	d=c;
    	 }	 
    	}	
    	cout<<d<<endl;
    	return 0;
    }
    
    • 1

    Information

    ID
    18904
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By