#include <stdio.h>
int N, One, Two, Three, Ball, Score;
int main(void) {
int i, num;
scanf("%d",&N);
for(i=1 ; i<=N ; i++) {
scanf("%d",&num);
if(num==1) Ball++;
if(num==3) {
Ball++;
if(Three) {
Three=0;
Score++;
}
if(Two) {
Two=0;
Three=1;
}
if(One) {
One=0;
Two=1;
}
}
if(num==2 || Ball==4) {
Ball=0;
if(One && Two && Three) {
Three=0;
Score++;
}
if(One && Two) {
Two=0;
Three=1;
}
if(One) {
One=0;
Two=1;
}
One=1;
}
}
printf("%d",Score);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1084 KB |
Output is correct |
2 |
Correct |
0 ms |
1084 KB |
Output is correct |
3 |
Correct |
5 ms |
1084 KB |
Output is correct |
4 |
Correct |
0 ms |
1084 KB |
Output is correct |
5 |
Correct |
0 ms |
1084 KB |
Output is correct |
6 |
Correct |
0 ms |
1084 KB |
Output is correct |
7 |
Correct |
2 ms |
1084 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1084 KB |
Output is correct |
2 |
Correct |
7 ms |
1084 KB |
Output is correct |
3 |
Correct |
7 ms |
1084 KB |
Output is correct |
4 |
Correct |
0 ms |
1084 KB |
Output is correct |
5 |
Correct |
0 ms |
1084 KB |
Output is correct |
6 |
Correct |
0 ms |
1084 KB |
Output is correct |
7 |
Correct |
0 ms |
1084 KB |
Output is correct |
8 |
Correct |
0 ms |
1084 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
1084 KB |
Output is correct |
2 |
Correct |
6 ms |
1084 KB |
Output is correct |
3 |
Correct |
2 ms |
1084 KB |
Output is correct |
4 |
Correct |
0 ms |
1084 KB |
Output is correct |
5 |
Correct |
4 ms |
1084 KB |
Output is correct |
6 |
Correct |
4 ms |
1084 KB |
Output is correct |
7 |
Correct |
0 ms |
1084 KB |
Output is correct |
8 |
Correct |
0 ms |
1084 KB |
Output is correct |
9 |
Correct |
3 ms |
1084 KB |
Output is correct |
10 |
Correct |
0 ms |
1084 KB |
Output is correct |
11 |
Correct |
5 ms |
1084 KB |
Output is correct |
12 |
Correct |
5 ms |
1084 KB |
Output is correct |
13 |
Correct |
7 ms |
1084 KB |
Output is correct |
14 |
Correct |
0 ms |
1084 KB |
Output is correct |
15 |
Correct |
0 ms |
1084 KB |
Output is correct |