Submission #13945

#TimeUsernameProblemLanguageResultExecution timeMemory
13945ainta볼질 (OJUZ10_ballparade)C++98
100 / 100
7 ms1084 KiB
#include<stdio.h> bool chk[3]; int R; void Move(){ if (chk[2])R++; chk[2] = chk[1]; chk[1] = chk[0]; chk[0] = false; } void Move2(){ if (chk[2]){ if (chk[0] && chk[1]){ R++; chk[2] = false; } } if (chk[1]){ if (chk[0]){ chk[2] = true; chk[1] = false; } } if (chk[0])chk[1] = true; chk[0] = true; } int main(){ int i, n, a, B = 0; scanf("%d", &n); while (n--){ scanf("%d", &a); if (a == 1){ if (B == 3){ Move2(); B = 0; } else B++; continue; } else if (a == 2){ Move2(); B = 0; } else{ Move(); B++; if (B == 4){ chk[0] = true; B = 0; } } } printf("%d\n", R); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...