1、Ad-hoc problem。。。具体不用我说,看代码吧(我真是越来越懒了。。。)
#include<cstdio> using namespace std; int a[100010]; int main(){ int n,num=0,ans=0,temp; scanf("%d",&n); for(int i=0;i<n;i++){ scanf("%d",&temp); if(temp!=-1) num+=temp; else{ if(num>0) num--; else ans++; } } printf("%d\n",ans); return 0; }