#include<vector>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stack>
using namespace std;
const int maxn = 1e5 + 10;
const int MOD = 1e9 + 7;
const int INF = 0x3fffffff;
typedef long long ll;
int n;
int main()
{
while(~scanf("%d",&n))
{
int tmp;
int h = 0, ans = 0;
while(n--)
{
scanf("%d",&tmp);
if(tmp == -1)
{
if(h == 0)
ans ++;
else
h += tmp;
}
else
h += tmp;
}
printf("%d\n",ans);
}
return 0;
}
codeforces 427A(水题)
最新推荐文章于 2019-02-08 08:17:42 发布