'commit'
This commit is contained in:
29
TangDou/LuoGuBook/P1420_1.cpp
Normal file
29
TangDou/LuoGuBook/P1420_1.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user