Submission #14291

#TimeUsernameProblemLanguageResultExecution timeMemory
14291mindol볼질 (OJUZ10_ballparade)C++98
100 / 100
7 ms1084 KiB
#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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...