7 solutions
-
0
#include<iostream> using namespace std; int main(){ int a[100010]; int n,max1=1,max2=0,t; cin>>n; if(n==1){ cout<<1; }else{ for(int i=0;i<n;i++){ cin>>a[i]; } t=a[0]; for(int i=1;i<n;i++){ if(a[i]==t){ max1+=1; }else{ if(max1>max2){ max2=max1; max1=1; t=a[i]; } } } cout<<max2; } return 0; }
Information
- ID
- 900
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 3
- Tags
- (None)
- # Submissions
- 176
- Accepted
- 43
- Uploaded By