1 solutions

  • 0
    @ 2024-8-30 16:42:19

    👍

    #include <bits/stdc++.h>
    #define INF 10234567
    using namespace std;
    int main()
    {
        int n,s[1001],ans=0,max=-INF;
        cin>>n;
        for(int i=1;i<=n;i++){
        	cin>>s[i];
    	}
        for(int i=1;i<=n;i++){
            if(s[i+1]-s[i]==1)ans++;
            else ans=0;
            if(ans>max)max=ans;
        }
        cout<<++max;
    }
    
    • 1

    Information

    ID
    70
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    10
    Tags
    # Submissions
    3
    Accepted
    3
    Uploaded By