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: 9ms
Memory: 2028kB
Author: 2018212212305
In contest: 1277

#include<iostream>
#include<cmath>
using namespace std;
int main(){
	int n;
	int sum=0,summ=0;
	int a[100002];
	while(scanf("%d",&n)!=EOF){
		sum=0;
		summ=0;
		for(int i=0;i<n;++i){
			cin>>a[i];
		}
		for(int i=0;i<n;++i){
		
			if(a[i]<0){
				sum+=a[i];
			}
			else if(a[i]>=0){
				sum+=(a[i]/2);
			}
			if(sum<0) summ++;
			
			}
			cout<<summ<<endl;
		
   }
}