Submission #14898

#TimeUsernameProblemLanguageResultExecution timeMemory
14898kyma123볼질 (OJUZ10_ballparade)C++98
100 / 100
13 ms1716 KiB
#include <iostream> using namespace std; int score; bool base[3]; void go() { if(base[0]) { if(base[1]) { if(base[2]) { score++; base[0] = false; } else { base[2] = true; base[0] = false; } } else { base[1] = true; base[0] = false; } } } void go_all() { if(base[2]) { score++; base[2] = false; } for(int i = 1; i >= 0; i--) { if(base[i]) { base[i + 1] = true; base[i] = false; } } } int main() { int n, b, ballcount = 0; cin >> n; for(; n--;) { cin >> b; if(b == 3) { go_all(); } if(b != 2) { ballcount++; if(ballcount == 4) { ballcount = 0; go(); base[0] = true; } } else { ballcount = 0; go(); base[0] = true; } } cout << score; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...