Files
python/TangDou/LuoGuBook/P1420_1.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

29 lines
465 B
C++

#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;
}