제출 #14182

#제출 시각아이디문제언어결과실행 시간메모리
14182gs14041볼질 (OJUZ10_ballparade)C++98
47 / 100
7 ms1084 KiB
#include<stdio.h>
int main()
{
    int score=0;
    int x[4]={};
    int n,i,j,a;
    int ball=0;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%d",&a);
        if(a==1 || a==3)
        {
            ball++;
            if(ball==4)
            {
                ball=0;
                if(a==1)
                {
                    if(x[1] && x[2])
                    {
                        score+=x[3];
                        x[3]=0;
                    }
                    if(x[1])
                    {
                        if(x[2]) x[3]=1;
                        x[2]=1;
                    }
                    x[1]=1;
                }
                if(a==3)
                {
                    score+=x[3];
                    x[3]=x[2];
                    x[2]=x[1];
                    x[1]=1;
                }
            }
            else
            {
                if(a==3)
                {
                    score+=x[3];
                    x[3]=x[2];
                    x[2]=x[1];
                    x[1]=0;
                }
            }
        }
        if(a==2)
        {
            ball=0;
            if(x[1] && x[2])
            {
                score+=x[3];
                x[3]=0;
            }
            if(x[1])
            {
                if(x[2]) x[3]=1;
                x[2]=0;
            }
            x[2]=x[1];
            x[1]=1;
        }
        //printf("%d   %d    %d %d %d     %d\n",a,ball,x[1],x[2],x[3],score);
    }
    printf("%d",score);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...