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: 1756kB
Author: 2018212212212
In contest: 1277

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<string>
using namespace std;
int const maxn=110;
int a,n,ans,sum;
int i,j;
int main(){
	while(~scanf("%d",&n)){
		sum=0,ans=0;
		for(int i=0;i<n;i++){
			scanf("%d",&a);
			if(a<0)
			ans+=a;
			else
			ans+=a/2;
			if(ans<0)
			sum+=1;
		}
		printf("%d\n",sum);
	}
	return 0;
}