Start: Jul, 01, 2019 08:30:00
2019年度暑期短学期第四天
End: Jul, 01, 2019 11:30:00
Time elapsed:
Time remaining:

Problem_ID: D
Result: Accepted
Time: 5ms
Memory: 1392kB
Author: 2018212212193
In contest: 1277

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(){
    int n,a[100000],num=0,b=0;
    while( scanf("%d",&n)!=EOF){
        num=0;
        b=0;
        memset(a,0,sizeof a);
        for(int i=0;i<n;i++){
            scanf("%d",&a[i]);
        }
        for(int l=0;l<n;l++){
            if(a[l]>=0)
                num=num+a[l]/2;
            else
                num=num+a[l];
            if(num<0)
                b=b+1;
        }
        printf("%d\n",b);
    }
    }