답안 #14178

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
14178 2015-05-03T05:59:44 Z kdh9949 볼질 (OJUZ10_ballparade) C++
100 / 100
6 ms 1084 KB
#include<stdio.h>
int t,n,i,j,s,c,ans,a[4];
void f1()
{
    if(a[3]&&a[2]&&a[1])a[3]--,ans++;
    if(a[2]&&a[1])a[2]--,a[3]++;
    if(a[1])a[2]++,a[1]--;a[1]++;
}
void f2()
{
    if(a[3])a[3]--,ans++;
    if(a[2])a[2]--,a[3]++;
    if(a[1])a[1]--,a[2]++;
}
int main()
{
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&t);
        if(t==1)
        {
            if(c==3)
            {
                f1();
                c=0;
            }
            else c++;
        }
        else if(t==2)
        {
            f1();
            c=0;
        }
        else if(t==3)
        {
            f2();
            if(c==3)
            {
                a[1]++;
                c=0;
            }
            else c++;
        }
    }
    printf("%d",ans);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1084 KB Output is correct
2 Correct 0 ms 1084 KB Output is correct
3 Correct 6 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 0 ms 1084 KB Output is correct
2 Correct 0 ms 1084 KB Output is correct
3 Correct 6 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
8 Correct 6 ms 1084 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 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 3 ms 1084 KB Output is correct
5 Correct 5 ms 1084 KB Output is correct
6 Correct 5 ms 1084 KB Output is correct
7 Correct 6 ms 1084 KB Output is correct
8 Correct 0 ms 1084 KB Output is correct
9 Correct 6 ms 1084 KB Output is correct
10 Correct 0 ms 1084 KB Output is correct
11 Correct 3 ms 1084 KB Output is correct
12 Correct 0 ms 1084 KB Output is correct
13 Correct 6 ms 1084 KB Output is correct
14 Correct 3 ms 1084 KB Output is correct
15 Correct 6 ms 1084 KB Output is correct