#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define PII pair<int,int >
#define int long long
#define IOS std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
const int N=1e6+10;
int n;
int va[N];
int cnt[N];
signed main()
{
IOS;
cin>>n;
for(int i=1;i<=n;i++) cin>>va[i];
int maxn=0;
for(int i=1;i<=n;i++)
{
if(va[i]==va[i-1]&&va[i]==va[i-2])
{
cnt[va[i]]+=3;
}
if(va[i]==va[i-1]&&va[i]!=va[i-2])
{
cnt[va[i]]+=2;
}
else
{
cnt[va[i]]+=1;
}
maxn=max(maxn,cnt[va[i]]);
}
cout<<maxn;
return 0;
}
分数计数(待修改)
于 2024-07-29 16:38:32 首次发布