文章
71
粉丝
142
获赞
5
访问
50.7k
#include<iostream>
#include<string>
#include<algorithm>
#include<climits>
#include<vector>
using namespace std;
const int maxn = 1000005;
int dp[maxn];//dp[i]表示以arr[i]结尾的最长连号
int arr[maxn];
int main() {
int n;
cin >> n;
for (int i = 0; i < n;i++) {
cin >> arr[i];
}
int ans = 0;
for (int i = 0; i < n;i++) {
if (i==0) {
dp[i] = 1;
}
else {
dp[i] = 1;
if (arr[i]-arr[i - 1]==1) {
dp[i] = dp[i-1]+1;
&nbs...
登录后发布评论
暂无评论,来抢沙发