제출 #1358089

#제출 시각아이디문제언어결과실행 시간메모리
1358089kmath628볼질 (OJUZ10_ballparade)C++20
100 / 100
2 ms344 KiB
#include <bits/stdc++.h>
int main(){
    int n,a=0,b=0,c=0,B=0,S=0,v;
    scanf("%d",&n);
    while(n--){
        scanf("%d",&v);
        if(v==1) B++;
        else if(v==2) B=4;
        else{
            B++;
            if(c==1) S++;
            c=b; b=a; a=0;
            if(B==4) a=1, B=0;
        }
        if(B==4){
            if(a==1 && b==1 && c==1) S++;
            else if(a==1 && b==1) c=1;
            else if(a==1) b=1;
            else a=1;
            B=0;
        }
    }
    printf("%d\n",S); return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

ballparade.cpp: In function 'int main()':
ballparade.cpp:4:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    4 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
ballparade.cpp:6:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |         scanf("%d",&v);
      |         ~~~~~^~~~~~~~~
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…