Submission #14106

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