이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma warning(disable:4996)
#include <stdio.h>
int b=0;
int score;
int base[4];
void ball() {
if (base[1] && base[2] && base[3]) {
base[3] = 0;
score++;
}
if (base[1] && base[2]) {
base[2] = 0;
base[3] = 1;
}
if (base[1]) {
base[1] = 0;
base[2] = 1;
}
base[1] = 1;
}
void ball_poktu() {
if (base[3]) {
base[3] = 0;
score++;
}
base[3] = base[2];
base[2] = base[1];
base[1] = 1;
}
void poktu() {
if (base[3]) {
base[3] = 0;
score++;
}
base[3] = base[2];
base[2] = base[1];
base[1] = 0;
}
int main()
{
int n;
scanf("%d", &n);
for (int i=0; i<n; i++) {
int x;
scanf("%d", &x);
if (x==1) {
b++;
if (b==4) {
b = 0;
ball();
}
}
else if (x==2) {
b = 0;
ball();
}
else {
b++;
if (b==4) {
b = 0;
ball_poktu();
}
else poktu();
}
}
printf("%d\n", score);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |