Submission #30698

#TimeUsernameProblemLanguageResultExecution timeMemory
30698okaybody10볼질 (OJUZ10_ballparade)C++98
100 / 100
9 ms1116 KiB
#include <stdio.h> #include <memory.h> int main() { int N; scanf("%d",&N); bool base[5]; memset(base,0,sizeof(base)); int ballcnt=0,error=0; for(int i=0;i<N;i++) { int throwb; scanf("%d",&throwb); if(throwb==1) { ballcnt+=1; if(ballcnt==4) { if(base[1] && base[2] && base[3]) { base[3]=false; error+=1; } if(base[1] && base[2]) { base[3]=true; } if(base[1]) base[2]=true; base[1]=true; ballcnt=0; } } else if(throwb==2) { if(base[1] && base[2] && base[3]) { base[3]=false; error+=1; } if(base[1] && base[2]) { base[3]=true; } if(base[1]) base[2]=true; base[1]=true; ballcnt=0; } else { ballcnt+=1; if(base[3]) { base[3]=false; error+=1; } if(base[2]) { base[3]=true; base[2]=false; } if(base[1]) { base[1]=false; base[2]=true; } if(ballcnt==4) { base[1]=true; ballcnt=0; } } } printf("%d",error); }

Compilation message (stderr)

ballparade.cpp: In function 'int main()':
ballparade.cpp:7:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&N);
                   ^
ballparade.cpp:14:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&throwb);
                            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...