Start: Jun, 28, 2019 13:00:00
2019年度暑期短学期第四天-助教场
End: Jun, 30, 2019 23:59:00
Time elapsed:
Time remaining:

Problem_ID: D
Result: Accepted
Time: 4ms
Memory: 1120kB
Author: 2018212212029
In contest: 1289

#include<stdio.h>
#include<string.h>
int main(){
	int n,q,luck,sum;
	while(~scanf("%d",&n)) {
		luck=0,q=0;
		for(int i=1;i<=n;i++){
			scanf("%d",&sum);
			if(sum<0) luck+=sum;
			else luck+=sum/2;
			if(luck<0) q++;
		}
		printf("%d\n",q);
	}
}