Submission #14267

#TimeUsernameProblemLanguageResultExecution timeMemory
14267moonrabbit2볼질 (OJUZ10_ballparade)C++98
100 / 100
7 ms1084 KiB
//1. 역시 갓승현... //2. 사이트 이름을 다시 GODainta.com으로! #include <cstdio> int main() { int n,base[3]={0},ballnum=0,score=0; scanf("%d",&n); for(int i=0;i<n;i++){ int ball,newbase[3]={0}; scanf("%d",&ball); if(ball==1){ ballnum++; if(ballnum!=4){ for(int j=0;j<4;j++)newbase[j]=base[j]; } if(ballnum==4&&base[0])newbase[1]=1; if(ballnum==4&&base[0]&&base[1])newbase[2]=1; else if(ballnum==4&&base[1])newbase[1]=1; if(ballnum==4&&base[0]&&base[1]&&base[2])score++; else if(ballnum==4&&base[2])newbase[2]=1; if(ballnum==4){ newbase[0]=1; ballnum=0; } } if(ball==2){ if(base[0])newbase[1]=1; if(base[0]&&base[1])newbase[2]=1; else if(base[1])newbase[1]=1; if(base[0]&&base[1]&&base[2])score++; else if(base[2])newbase[2]=1; newbase[0]=1; ballnum=0; } if(ball==3){ ballnum++; if(ballnum==4){ newbase[0]=1; ballnum=0; } if(base[0])newbase[1]=1; if(base[1])newbase[2]=1; if(base[2])score++; } for(int j=0;j<3;j++)base[j]=newbase[j]; } printf("%d",score); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...