이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<stdio.h>
bool chk[3];
int R;
void Move(){
if (chk[2])R++;
chk[2] = chk[1];
chk[1] = chk[0];
chk[0] = false;
}
int main(){
int i, n, a, B = 0;
scanf("%d", &n);
while (n--){
scanf("%d", &a);
if (a == 1){
if (B == 3){
Move();
B = 0;
chk[0] = true;
}
else B++;
continue;
}
else if (a == 2){
B = 0;
Move();
chk[0] = true;
}
else{
Move();
B++;
if (B == 4){
chk[0] = true;
B = 0;
}
}
}
printf("%d\n", R);
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |