#include <iostream>

int main() {
    int data[] = {1, 2, 3, -1, 2, 3, 4, 5, -1, 1, 2};
    int size = sizeof(data) / sizeof(data[0]);

    int max = 0;
    int numcount = 0;
    int checksum = 0;
    
    for(int i = 0; i<size; i++) 
    {
        if(data[i] != -1) 
        {
            numcount++;
            checksum += data[i];
        }
        else
        {
            if(checksum >= 10) 
            {
                if(max < numcount) 
                {
                    max = numcount;
                }

            }
            numcount = 0;
            checksum = 0;
        }
        
    }

    if(numcount > max && checksum >= 10) 
    {
        max = numcount;
    }

    printf("max_len = %d",max);
    
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: