답안 #14291

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
14291 2015-05-10T04:52:05 Z mindol 볼질 (OJUZ10_ballparade) C++
100 / 100
7 ms 1084 KB
#include<cstdio>
int juja[4];
int ball_count;
int main()
{
    int n,i,now,score=0;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%d",&now);
        switch(now)
        {
        case 1:
            ball_count++;
            if(ball_count==4)
            {
                ball_count=0;
                if(juja[3]==1 && juja[2]==1 && juja[1]==1)
                    score++;
                else if(juja[2]==1 && juja[1]==1)
                    juja[3]=1;
                else if(juja[1]==1)
                    juja[2]=1;
                else juja[1]=1;
            }
            break;
        case 2:
            ball_count=0;
            if(juja[3]==1 && juja[2]==1 && juja[1]==1)
                score++;
            else if(juja[2]==1 && juja[1]==1)
                juja[3]=1;
            else if(juja[1]==1)
                juja[2]=1;
            else juja[1]=1;
            break;
        case 3:
            ball_count++;
            if(juja[3]==1) juja[3]=0,score++;
            if(juja[2]==1) juja[3]=1,juja[2]=0;
            if(juja[1]==1) juja[2]=1,juja[1]=0;
            if(ball_count==4) ball_count=0,juja[1]=1;
            break;
        }
    }
    printf("%d",score);
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1084 KB Output is correct
2 Correct 0 ms 1084 KB Output is correct
3 Correct 5 ms 1084 KB Output is correct
4 Correct 0 ms 1084 KB Output is correct
5 Correct 0 ms 1084 KB Output is correct
6 Correct 0 ms 1084 KB Output is correct
7 Correct 0 ms 1084 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1084 KB Output is correct
2 Correct 0 ms 1084 KB Output is correct
3 Correct 0 ms 1084 KB Output is correct
4 Correct 4 ms 1084 KB Output is correct
5 Correct 3 ms 1084 KB Output is correct
6 Correct 0 ms 1084 KB Output is correct
7 Correct 0 ms 1084 KB Output is correct
8 Correct 0 ms 1084 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 1084 KB Output is correct
2 Correct 7 ms 1084 KB Output is correct
3 Correct 0 ms 1084 KB Output is correct
4 Correct 5 ms 1084 KB Output is correct
5 Correct 4 ms 1084 KB Output is correct
6 Correct 0 ms 1084 KB Output is correct
7 Correct 2 ms 1084 KB Output is correct
8 Correct 3 ms 1084 KB Output is correct
9 Correct 5 ms 1084 KB Output is correct
10 Correct 0 ms 1084 KB Output is correct
11 Correct 6 ms 1084 KB Output is correct
12 Correct 5 ms 1084 KB Output is correct
13 Correct 5 ms 1084 KB Output is correct
14 Correct 0 ms 1084 KB Output is correct
15 Correct 0 ms 1084 KB Output is correct