This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
//int taja = 0;
int len;
char ball = 0;
char m[3]={0,};
int score = 0;
void jinru() {
if(m[0]) {
if(m[1]) {
if(m[2]) {
m[2] = 0;
score++;
}
m[2] = m[1];
}
m[1] = m[0];
}
ball = 0;
}
int main() {
scanf("%d", &len);
int i;
for(i = 0; i < len; i++) {
int b;
scanf("%d", &b);
switch(b) {
case 1:
ball++;
//printf("Ball! %d\n", taja);
if(ball == 4) {
jinru();
m[0] = 1;
//taja++;
}
break;
case 2:
//printf("Deadball! %d\n", taja);
jinru();
m[0] = 1;
//taja++;
break;
case 3:
if(m[2]) score++;
m[2] = m[1];
m[1] = m[0];
if(ball == 3) {
ball = 0;
m[0] = 1;
//printf("Poktu! %d\n", taja++);
}
else {
ball++;
m[0] = 0;
//printf("Poktu! %d\n", taja);
}
break;
}
}
printf("%d", score);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |