Source Code
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int N;
    int sum=0;
    int x = 0;

    scanf("%d", &N);

    for(int i=1;i<=N;i++){
        int a = 0;
        scanf("%d",&a);
        sum += a;

        if(sum <= 0){
            x += 1;
        }
    }
    printf("%d\n",x);

    return 0;
}
Copy
Zeina The Business Owner Qais Jildeh
GNU G++17
2 ms
624 KB
Wrong Answer