为什么80?
  • 板块P1420 最长连号
  • 楼主lofing
  • 当前回复5
  • 已保存回复6
  • 发布时间2024/10/31 19:59
  • 上次更新2024/10/31 22:15:45
查看原帖
为什么80?
1275297
lofing楼主2024/10/31 19:59

这个和错误下载的输出一样啊???

#include<iostream>
using namespace std;
int arr[10001];
int main() {
//	freopen("P1420_4.in","r",stdin);
	int n,lmax = 1,len = 1;
	cin>>n;
	for(int step = 0; step < n; step++) {
		cin>>arr[step];
	}		  //pd
	for(int step = 0; step < n; step++) {
		if(arr[step] == arr[step - 1] + 1) {
			len++;
		}
		else len = 1;
		if(len > lmax){
			lmax = len;
		}
	}
	cout<<lmax;
	return 0;
}

2024/10/31 19:59
加载中...