[c++]代码库
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string.h>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<set>
#include<vector>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
const int maxn =1e5+5;
const int maxm=10000;
const int mod =1e9+7;
const int INF=0x3f3f3f3f;
const double eps=1e-8;
int a[maxn];
int main()
{
int n,k;scanf("%d%d",&n,&k);
for(int i=0;i<n;i++)scanf("%d",&a[i]);
int ans=1;int cnt=1;
for(int i=1;i<n;i++)
{
if(a[i]!=a[i-1]) cnt++;
else cnt=1;
ans=max(ans,cnt);
}
printf("%d\n",ans);
return 0;
}