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.

29 lines
465 B

#include <bits/stdc++.h>
using namespace std;
int Max;
int x, y, len = 1;
int main() {
int n;
/*
10
1 5 6 2 3 4 5 6 8 9
*/
cin >> n; // 10
cin >> x; // 1
for (int i = 2; i <= n; i++) {
cin >> y;
if (y == x + 1)
len++, Max = max(Max, len);
else
len = 1;
//这句话需要重点理解
x = y;
}
cout << Max << endl;
return 0;
}