提交时间:2024-11-08 15:42:20

运行 ID: 55809

#include<iostream> using namespace std; int main(){ int max = 0, l = 1, a[1000], n; cin >> n; for(int i = 0; i < n; i++){ cin >> a[i]; if(a[i] == a[i-1]){ l++; } else{ if(l > max){ max = l; l = 1; } } } cout << max; return 0; }