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: 4ms
Memory: 1120kB
Author: 2018212212105
In contest: 1277

#include <stdio.h> 


int main() {
	int n,i,j,k;
	float l,m,v;
	
	while((scanf("%d",&n)) != EOF) {
		int a[n];
		for(i = 0;i < n;i++) {
			scanf("%d",&a[i]);
		}
		if(a[0] < 0) {
			k = 1;
			l = a[0];
		}else {
			k = 0;
			l = (double)a[0] / 2;
		}
		/*printf("%f  ",l);*/
		for(i = 1;i < n;i++) {
			m = (double)a[i] / 2;
			v = (double)a[i];
				/*printf("%f %f  ",m,v);*/
			if(a[i] >= 0) {
				if(l+m < 0) {
					k++;
					l += m;
				}else {
					l += m;
				}
			}else {
				if(l + v >= 0) {
					l += v ;
				}else {
					k++;
					l += v;
					
				}
			}
		}
		printf("%d\n",k);
	
	}
	return 0;
}