Submission #18599

#TimeUsernameProblemLanguageResultExecution timeMemory
18599jjhstop볼질 (OJUZ10_ballparade)C++98
100 / 100
7 ms1084 KiB
#include<stdio.h> int base; int score; int ball; void fball() { switch (base) { case 0: case 2: case 4: case 6: base++; break; case 1: case 5: base += 2; break; case 3: base += 4; break; case 7: default: score++; break; } } void wball() { switch (base) { case 4: case 5: case 6: case 7: score++; break; default: break; } base <<= 1; base &= 7; } void process(int a) { switch (a) { case 1: ball++; if (ball == 4) { ball = 0; fball(); } break; case 2: ball = 0; fball(); break; case 3: ball++; wball(); if (ball == 4) { fball(); ball = 0; } break; } } int main() { int N, t; //freopen("input.txt", "r", stdin); scanf("%d", &N); for (int i = 0; i < N; i++) { scanf("%d ", &t); process(t); } printf("%d", score); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...