-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA.cpp
More file actions
25 lines (20 loc) · 664 Bytes
/
A.cpp
File metadata and controls
25 lines (20 loc) · 664 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdio.h>
#include <stdlib.h>
int main()
{
long police=0,unNoticedCrime=0,n,i;
int x;
fscanf(stdin,"%ld",&n);
if(n>=1 && n<=100000){
for(i=0;i<n;i++){
fscanf(stdin,"%d",&x);
switch (x){
case -1: if(police > 0) --police; else ++unNoticedCrime;
break;
default: police+=x;
}
}
}
fprintf(stdout,"%ld",unNoticedCrime);
return(0);
}