这道题目挺简单的,那你还想这么久!
直接看代码!
#include<cstdio>
long long n,a[100002],sum,b[100002],max=-99999,j;
int main(){scanf("%d",&n);scanf("%d",&a[1]);sum=1;for(int i=2;i<=n;i++){j++;scanf("%d",&a[i]);if(a[i]==a[i-1]){sum++;b[j]=sum;}else{sum=1;}}for(int i=1;i<=j;i++){if(b[i]>max){max=b[i];}}printf("%d",max);
}
交给读者细品,先溜了