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 base;
int score;
int ball;
void fball()
{
switch (base) {
case 0:
case 2:
case 4:
case 6:
base++;
break;
case 1:
case 5:
base += 2;
break;
case 3:
base += 4;
break;
case 7:
default:
score++;
break;
}
}
void wball()
{
switch (base) {
case 4:
case 5:
case 6:
case 7:
score++;
break;
default:
break;
}
base <<= 1;
base &= 7;
}
void process(int a)
{
switch (a) {
case 1:
ball++;
if (ball == 4) {
ball = 0;
fball();
}
break;
case 2:
ball = 0;
fball();
break;
case 3:
ball++;
wball();
if (ball == 4) {
fball();
ball = 0;
}
break;
}
}
int main()
{
int N, t;
//freopen("input.txt", "r", stdin);
scanf("%d", &N);
for (int i = 0; i < N; i++) {
scanf("%d ", &t);
process(t);
}
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... |