Skip to content

Commit 1d83654

Browse files
committed
Create 1696B-NITDestroysTheUniverse.cpp
1 parent 55d636f commit 1d83654

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

1696B-NITDestroysTheUniverse.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <cstdio>
2+
3+
int main(){
4+
5+
long t; scanf("%ld", &t);
6+
while(t--){
7+
long n; scanf("%ld", &n);
8+
long cnt(0); bool cur(0);
9+
while(n--){
10+
long x; scanf("%ld", &x);
11+
if(x){cur = 1;}
12+
else if(cur){++cnt; cur = 0;}
13+
}
14+
15+
cnt += cur;
16+
cnt = (cnt < 2) ? cnt : 2;
17+
printf("%ld\n", cnt);
18+
}
19+
20+
}

0 commit comments

Comments
 (0)