#include<stdio.h> int main(){ int i,n,a,num[1000],max=1; int cnt=1; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&a); num[i]=a; } for(i=0;i<n;i++){ if(num[i+1]==num[i])cnt++; else{ if(cnt>max)max=cnt; cnt=1; } } printf("%d",max); return 0; }
By signing up a 追梦算法网 universal account, you can submit code and join discussions in all online judging services provided by us.
Using your 追梦算法网 universal account