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: 9ms
Memory: 2500kB
Author: 2018212212317
In contest: 1289

#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<string>
#include<vector> 
using namespace std;
const int maxn = 100010;
const int inf = 0x3f3f3f3f;
const int modu = 1e9+7;
int n,m,k,t,ans,sum;
int a[maxn],vis[maxn];
vector<int> v[30];
string s;
int main(){
	while(scanf("%d",&n)!=EOF){
		ans=0;
		sum=0;
		for(int i=0;i<n;i++){
			cin>>k;
			if(k>0) sum+=k/2;
			else sum+=k;
			if(sum<0) ans++;
		}
		cout<<ans<<endl;
	} 
	return 0;
}