답안 #14106

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
14106 2015-05-02T05:45:54 Z juchan1220 볼질 (OJUZ10_ballparade) C++
100 / 100
7 ms 1084 KB
#include <stdio.h>
#include <algorithm>
using namespace std;
int n,score,base[4];
void bob (void)
{
    if(base[0]+base[1]+base[2]==3)//홈인
        score++;
    base[2]=max(base[2],(base[1]+base[0])/2);
    base[1]=max(base[1],base[0]);

    return ;
}
void bob2 (void)
{
    if(base[2]==1)
        score++;
    base[2]=base[1];
    base[1]=base[0];
    base[0]=0;
    return ;
}
int main (void)
{
    int i,t,ball=0;
    scanf("%d",&n);

    for(i=0;i<n;i++){
        scanf("%d",&t);

        if(t==1)
            ball++;
        else if(t==2){
            bob();
            base[0]=1;
            ball=0;
        }
        else{
            bob2();
            ball++;
        }

        if(ball==4){
            bob();
            base[0]=1;
            ball=0;
        }

    }

    printf("%d\n",score);

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 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 0 ms 1084 KB Output is correct
4 Correct 0 ms 1084 KB Output is correct
5 Correct 7 ms 1084 KB Output is correct
6 Correct 2 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 0 ms 1084 KB Output is correct
2 Correct 6 ms 1084 KB Output is correct
3 Correct 0 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 4 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 5 ms 1084 KB Output is correct
11 Correct 6 ms 1084 KB Output is correct
12 Correct 7 ms 1084 KB Output is correct
13 Correct 0 ms 1084 KB Output is correct
14 Correct 3 ms 1084 KB Output is correct
15 Correct 6 ms 1084 KB Output is correct