You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
571 B

2 years ago
#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 10;
//常数,正无穷大
const int INF = 0x3f3f3f3f;
int a[N];
int Max = -INF, len = 1;
/*
1 1
1
1
*/
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
if (i > 1) {
if (a[i] - a[i - 1] == 1)
len++;
else
len = 1;
}
Max = max(Max, len);
}
cout << Max << endl;
return 0;
}