提交时间:2024-11-01 15:46:02

运行 ID: 54970

#include<bits/stdc++.h> using namespace std; int main(){ int n, max = -999, now; cin >> n; int a[n]; for(int i =0; i = n; i++){ cin >> a[i]; if(a[i] == a[i - 1]){ now = 1; }else{ now ++; } if(now >= max){ max = now; } } cout << max; return 0; }