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: 8ms
Memory: 1712kB
Author: 2017212212237
In contest: 1289

#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define INF 0x3f3f3f3f
#define lowbit(x) (x&(-x))
using namespace std;
typedef long long ll;

const int maxn = 1e4+7;


int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        int x;
        int tot = 0;
        int ans = 0;
        for(int i=0;i<n;i++)
        {
            scanf("%d",&x);
            if(x > 0)
                tot += x/2;
            else
                tot += x;
            if(tot < 0)
                ans++;
        }
        printf("%d\n",ans);
    }
}