错成这样子:
80
我要给自己一个了:80,80,80,80,80……
#include <bits/stdc++.h>
using namespace std;
int cnt,maxx,x,y,i,n;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n;
for(i=1;i<=n;i++){
cin>>x;
if(y==x-1)
cnt++;
else{
maxx=max(maxx,cnt);
cnt=1;
}
y=x;
}
cout<<maxx;
return 0;
}
丢,最后一次没发现
最后要加一句:
maxx=max(maxx,cnt);
啊啊啊啊啊啊啊啊啊!
好了,就到这里吧。